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

jQuery plugin breaks ScrollMagic 2.0.0 #268

Closed
PieterGoossens opened this issue Mar 16, 2015 · 4 comments
Closed

jQuery plugin breaks ScrollMagic 2.0.0 #268

PieterGoossens opened this issue Mar 16, 2015 · 4 comments
Labels

Comments

@PieterGoossens
Copy link

Hi,

including the 'jquery.ScrollMagic.js' plugin seems to break ScrollMagic 2.0.0. For example, I've use the following HTML markup:

<html>
   <head>
       <script src="http://code.jquery.com/jquery-1.11.2.js"></script>
       <script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.0/ScrollMagic.js"></script>
       <script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.0/plugins/jquery.ScrollMagic.js"></script>
   </head>
    <body>
        ...
    </body>
</html>

Typing in ScrollMagic.version in Chrome's console yields the following error:

Uncaught ReferenceError: ScrollMagic is not defined

As soon as I remove the jquery.ScrollMagic.js line from the head of the document, typing in ScrollMagic.version correctly returns 2.0.0 as the version. I've also tried the latest 2.x version of jQuery, but the problem persists.

Is this a bug/issue with ScrollMagic/it's jQuery plugin or a PEBCAK?

@janpaepke janpaepke added the bug label Mar 17, 2015
@janpaepke
Copy link
Owner

Nope, that's totally my fault.
If something is a jQuery plugin it should be available within the jQuery namespace.
That is why when using this plugin ScrollMagic is available using $.ScrollMagic (see here).
I had some discussions with colleagues wether or not this should mean that the regular browser global (ScrollMagic) should be removed.

The consensus was, that it shouldn't. Exactly because of situations like this, where it might cause confusion.
Unfortunately I seem to have forgotten to remove the deletion of the browser global, before releasing 2.0.0.
My bad. :)

This will be fixed for the next release.

In the meantime you can either remove line 40 of jquery.ScrollMagic.js or use $.ScrollMagic instead.

@PieterGoossens
Copy link
Author

Commenting out line 40 of jquery.ScrollMagic.js, or even better switching to ScrollMagic 2.0.1, works like a charm! Thanx!

@janpaepke
Copy link
Owner

glad I could help :)

@bg87
Copy link

bg87 commented Dec 14, 2016

I'm using scrollmagic 2.0.3 and this issue is happening.

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

No branches or pull requests

3 participants