Get new jQuery plugins just once a week
September 10, 2012
Waypoints | A small jQuery plugin for scroll events
Waypoints is a small jQuery plugin that makes it easy to execute a function whenever you scroll to an element.
Waypoints makes a solid base for modern UI patterns that depend on a user’s scroll position on the page.
The waypoint namespace extension to the jQuery effin’ object. This is the meat of the plugin, calling .waypoint on one or more elements and registering handlers for when the elements have been reached.It has the following options :-
- contextThe context defines which scrollable element the waypoint belongs to and acts within. The default, window, means the waypoint offset is calculated with relation to the whole viewport. You can set this to another element to use the waypoints within that element
- continuousIf true, and multiple waypoints are triggered in one scroll, this waypoint will trigger even if it is not the last waypoint reached. If false, it will only trigger if it is the last waypoint.
- handlerAn alternative way to bind functions to the waypoint without using the first argument of the waypoint function.
- offsetDetermines how far the top of the element must be from the top of the browser window to trigger a waypoint. It can be a number, which is taken as a number of pixels, a string representing a percentage of the viewport height, or a function that will return a number of pixels.
- onlyOnScrollIf true, this waypoint will not trigger if an offset change during a refresh causes it to pass the current scroll point.
- triggerOnceIf true, the waypoint will be destroyed when triggered.
alert('You have scrolled to an entry.');
Created by Caleb Troughton
Waypoints makes it easy to execute a function whenever you scroll to an element.
To install using Bower
bower install waypoints
Sign up for our weekly newsletter.