Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'add' of undefined #292

Closed
neiltomlow opened this issue Nov 28, 2017 · 5 comments
Closed

Uncaught TypeError: Cannot read property 'add' of undefined #292

neiltomlow opened this issue Nov 28, 2017 · 5 comments

Comments

@neiltomlow
Copy link

Hi,
I've headroom.js in a WP theme. Now I want to add a post grid on a page, but headroom.js seems to block this. I've got this error:

plugins.js?ver=4.9:44 Uncaught TypeError: Cannot read property 'add' of undefined
at e.init (plugins.js?ver=4.9:44)
at headroom.js?ver=4.9:5
init @ plugins.js?ver=4.9:44
(anonymous) @ headroom.js?ver=4.9:5

You can find it on this webpage: http://klanten.bureautint.nl/red/test-page/.

Please help...

@calebmichaelsanchez
Copy link

calebmichaelsanchez commented Jan 24, 2018

You ever find a solution to this? I'm dealing with a similar problem.

edit: The element I was passing to the Headroom constructor a properjs object. Had to append a [0] to the element.

@OlegFilth
Copy link

when requires with browserify I have error like this bundle.js?ver=1.0.0:1 Uncaught TypeError: Cannot read property 'unslick' of undefined at m.fn.init.t.fn.slick (bundle.js?ver=1.0.0:1)

@jrondorf
Copy link

Try to add the initialisation code into

http://learn.jquery.com/using-jquery-core/document-ready/

@coder618
Copy link

coder618 commented Oct 4, 2019

edit: The element I was passing to the Headroom constructor a properjs object. Had to append a [0] to the element.

Thanks man, its working but why i have to parse [0], when there is only one item in the dom

@WickyNilliams
Copy link
Owner

Are you using querySelectorAll? This always returns an array, even if there's a single matching item. Try querySelector instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants