7 Uncaught Error: No element option passed to Waypoint constructor
Hello there. I have downloaded waypoint jquery.waypoints.min.js from http://imakewebthings.com And having inserted the code below i have become suffering from the following issue:jquery.waypoints.min.js:7 Uncaught Error: No element option passed to Waypoint constructor at new t (jquery.waypoints.min.js:7) at (index):283
The Code:
var waypoint = new Waypoint({
element: document.getElementById('#two'),
handler: function(direction) {
alert('I am 20px from the top of the window');
},
});
``
Could anyone tell me what i have done wrong ?
Thanks !
I found this helpful: https://stackoverflow.com/questions/40252534/waypoints-no-element-option-passed-to-waypoint-constructor
This is an old post, if someone is still getting an error check where you put your index.js or main.js script import. I just encountered this issue, but I figured that my script is being ran before any content was loaded that's why I'm getting the error. Moved it before the `
' tag, a very basic mistake on my part nonetheless.
Hi! Looks like this:
var waypoint = new Waypoint({
element: document.getElementById('#two'),
handler: function(direction) {
alert('I am 20px from the top of the window');
},
});
should be fixed to this:
var waypoint = new Waypoint({
element: document.getElementById('two'),
handler: function(direction) {
alert('I am 20px from the top of the window');
},
});
:warning: In any case - attention should be concentrated at the symbol # in first case and its absence for the next block.
Hope this helps!
I believe this could be closed...
I had this same issue. As someone here suggested, the fix was to move the javascript
var waypoint = new Waypoint
to the end of the html page. So it was called in the header section, I moved it to the end.