I’m trying to use the Waypoints plugin for jQuery to lazy load elements on a webpage. However I can’t get it to work.
I made a very basic example: http://jsfiddle.net/P3XnN/2/
According to the Waypoints documentation all I need to do is the following.
JS:
$('#waypoint').waypoint(function() {
alert('You have scrolled to my waypoint.');
});
HTML:
<div style="height: 500px">Scroll down</div>
<div id="waypoint">Waypoint</div>
But it isn’t as simple as that apparently. What can I try next?
The plugin docs reveal an
offsetoption that does the following:You can pass options to the
waypointmethod as the 2nd argument:Here’s an update fiddle. Updated broken CDN resource 2022.