Detect first page load with jQuery?

后端 未结 4 1665
耶瑟儿~
耶瑟儿~ 2021-02-14 08:15

I need to detect the first time a page loads in jQuery so that I can perform some actions only when the page loads the first time a user navigates to that page. Similar to serve

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-14 09:03

    The easy solution is to use jQuery ‘Once’ plugin

    $(element).once('class-name', function() {
      // your javascript code
    });
    

提交回复
热议问题