A jQuery plugin that makes it easy to execute a function whenever you scroll to an element.
npm install jquery-waypointsjs
$('.thing').waypoint(function() {
alert('You have scrolled to a thing.');
});
`
If you're new to Waypoints, check out the Get Started section.
Read the full documentation for more details on usage and customization.
Shortcuts
In addition to the normal Waypoints script, extensions exist to make common UI patterns just a little easier to implement:
- Infinite Scrolling
- Sticky Elements
Examples
Waypoints can also be used as a base for your own custom UI patterns. Here are a few examples:
- Scroll Analytics
- Dial Controls
AMD Module Loader Support
If you're using an AMD loader like RequireJS, Waypoints registers itself as a named module, 'waypoints'. Shortcut scripts are anonymous modules.
Development Environment
If you want to contribute to Waypoints, I love pull requests that include changes to the source coffee files as well as the compiled JS and minified files. You can set up the same environment by running make setup (which just aliases to npm install). This will install the version of CoffeeScript and UglifyJS that I'm using. From there, running make build` will compile and minify all the necessary files. Test coffee files are compiled on the fly, so compile and minify do not apply to those files.