waypoints icon indicating copy to clipboard operation
waypoints copied to clipboard

7 Uncaught Error: No element option passed to Waypoint constructor

Open ghost opened this issue 8 years ago • 5 comments

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 !

ghost avatar Nov 05 '17 02:11 ghost

I found this helpful: https://stackoverflow.com/questions/40252534/waypoints-no-element-option-passed-to-waypoint-constructor

johnsmith098096 avatar Jan 03 '18 08:01 johnsmith098096

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.

yvhr avatar Oct 06 '18 02:10 yvhr

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!

tbaltrushaitis avatar Oct 06 '18 04:10 tbaltrushaitis

I believe this could be closed...

tbaltrushaitis avatar Oct 15 '18 00:10 tbaltrushaitis

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.

jaredchristiansen avatar Apr 11 '19 17:04 jaredchristiansen