-
Notifications
You must be signed in to change notification settings - Fork 826
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 ReferenceError: Headroom is not defined #299
Comments
i'm getting the same errors...same import statements...any ideas? |
you can change |
Hey, excuse the delay in reply! I'm considering changing the jquery plugin to receive So it would work something like this: import $ from 'jquery';
import Headroom from 'headroom.js';
import registerPlugin 'headroom.js/dist/jQuery.headroom.js';
registerPlugin($, Headroom);
// then
$("header").headroom(); How does this sound? It should fix the issues here. I may even choose to bundle Headroom with the jQuery plugin, so that you don't need to install/import Headroom separately. |
My reason for doing this is that jQuery is technically a peer dep of the jQuery.headroom plugin. But I don't want to add it as a peer dep to the repo, as it will force people to install jquery even if they're not using the jquery plugin. So my options are:
It seems like (2) is the best option |
What exactly are the benefits of using the jQuery version vs vanilla? New repo just for that sounds like more work than necessary to solve this. |
Good point, there was another option:
Which is actually quite attractive. Same (or even especially) for angular. I don't use angular and never have. And from the issues it seems like that has never quite worked right |
This will be dealt with via #140 |
I've been trying to implement headroom.js in a new project using jQuery. The version of headroom.js being used is 0.9.4 and was installed via
yarn add headroom.js
However, I'm getting a JavaScript reference error
Uncaught ReferenceError: Headroom is not defined
. This error is happening in thejQuery.headroom.js
file.line 23:
options = $.extend(true, {}, Headroom.options, options);
The import statements being used are
My workaround for this has been to do the following. It doesn't seem like best practice though and perhaps the jQuery plugin should reference the global window scope?
Any ideas or comments?
The text was updated successfully, but these errors were encountered: