Search code examples
javascriptjquerycssjquery-pluginsjquery-waypoints

jQuery Sticky Waypoints Direction option not working


I am using the combination of jQuery Waypoints and it's plugin "sticky elements". Based on the documentation (http://imakewebthings.com/jquery-waypoints/shortcuts/sticky-elements/) I am using the following code

$('#nav').waypoint('sticky', {
  direction: 'up',
  stuckClass: 'stuck'
});

The plugin functions and the element becomes sticky, the problem is it does not seem to take in to account the direction in which the user scrolls (up or down); and it becomes sticky regardless of the direction. According tot he documentation it should only be becoming sticky on upward scrolling.


Solution

  • This was answered in an issue on the repo, but I will mirror it here:

    The direction option for the Sticky shortcut wasn't added until 2.0.5. Upgrading to 2.0.5 should solve this.