I am using waypoints in my rails project. (using gem waypoints_rails)
Waypoints is working fine on the page I want it to work on. The elements I am using waypoints with only exist on this page. I am using Waypoint Inview.
var inview = new Waypoint.Inview({
element: $('#the-element')[0],
entered: function(direction) {
console.log("working");
}
});
This is working correctly.
However, my home page is now giving this error :
Uncaught Error: No element option passed to Waypoint constructor
Any help ?
I had the same problem. Try wrapping your waypoint in a conditional to check if the element exists on the page.
if ( $( "#the-element" ).length ) {
var inview = new Waypoint.Inview({
element: $('#the-element')[0],
entered: function(direction) {
console.log("working");
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With