Posted By

Narayon on 04/16/12


Tagged

scroll javascript js jquery


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

BrockSamsom


Substitute for the scroll event


 / Published in: jQuery
 

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

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

  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);

Report this snippet  

You need to login to post a comment.