Is there a Javascript event that fires when an HTML element scrolls?

I want to load elements when they are moved to the view in order to reduce server load, for example. thumbnails, but would like their divs placeholder divs exist from the moment the page loads. To do this, I think I need some kind of trigger when the div becomes visible.

jquery-appear , but I can’t get a copy of it from anywhere (Google gives me 403 error)

Does anyone know how to do this?

+6
source share
1 answer

I think jQuery's waypoints are a plugin that you might need:

http://imakewebthings.com/jquery-waypoints/

Below you can name the waypoint plugin:

 $(document).ready(function() { var $loading = $("<div class='loading'><p>Loading more items&hellip;</p></div>"), $footer = $('footer'), opts = { offset: '100%' }; $footer.waypoint(function(event, direction) { $footer.waypoint('remove'); $('body').append($loading); $.get($('.more a').attr('href'), function(data) { var $data = $(data); $('#container').append($data.find('.article')); $loading.detach(); $('.more').replaceWith($data.find('.more')); $footer.waypoint(opts); }); }, opts); }); 
+5
source

All Articles