Substitute for the scroll event


/ Published in: jQuery
Save to your folder(s)

Another approach that helps saving the overhead calls of the scroll event and the subsequent code.


Copy this code and paste it in your HTML
  1. var outerPane = $details.find(".details-pane-outer"),
  2. didScroll = false;
  3.  
  4. $(window).scroll(function() {
  5. didScroll = true;
  6. });
  7.  
  8. setInterval(function() {
  9. if ( didScroll ) {
  10. didScroll = false;
  11. // Check your page position and then
  12. // Load in more results
  13. }
  14. }, 250);

URL: http://ejohn.org/blog/learning-from-twitter/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.