简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM