So I've done everything that is supposed to happen in order to initialize the jquery waypoints-sticky plugin, but it isn't working: included jquery, waypoints, and waypoints-sticky, and called the function:
$('.my-element').waypoint('sticky');
However, the console reads ("The sticky method does not exist in jQuery Waypoints."):
What could I possibly be missing? Nothing online gives me any ideas at all. Thanks for your input!
This shortcut requires the jQuery build of Waypoints.
First, include the shortcut script after the main Waypoints script.
<script src="/path/to/lib/jquery.waypoints.min.js"></script>
<script src="/path/to/shortcuts/sticky.min.js"></script>
var sticky = new Waypoint.Sticky({
element: $('.basic-sticky-example')[0]
})
Have you seen http://imakewebthings.com/waypoints/shortcuts/sticky-elements/ ?
Make sure that everything's getting loaded before your code executes. Try wrapping your code in a $(document).ready() call, like so:
$(document).ready(function () {
$('.my-element').waypoint('sticky');
});
Equivalently, and slightly more concise:
$(function () {
$('.my-element').waypoint('sticky');
});
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.