JS waypoints below-in-overview, is there top-to-top?

Im using waypoints js to detect when an item is in the viewport.

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

https://github.com/imakewebthings/waypoints

Is it possible to determine when the top element is at the bottom of the viewport?

Greetings

Ka

+8
javascript scroll viewport jquery-waypoints
source share
1 answer

No one has yet given the correct answer, so here is mine.

As you already know, the Waypoint plugin has an offset option. This option starts the handler function after the top or bottom of your element has passed either the top or bottom of the viewport.

The percentage offset is the height of the viewport in which you want the function to work - 0% is in the upper right, 50% in the middle and 100% in the bottom.

To start the handler function when the top of your element appears immediately, you will need to use 100%, for example:

 $('.sections').waypoint({ handler: function(direction) { // do stuff }, offset: '100%' }); 
+15
source share

All Articles