-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
ScrollMagic is not defined [using webpack] #771
Comments
This is probably because your custom js code is above ScrollMagic library. In your HTML it should be: |
I appreciate the help. Unfortunately, this doesn't resolve the issue. See I am trying to incorporate ScrollMagic and GSAP with Webpack. I have been successful at getting Webpack to include ScrollMagic in the build.js. And according to my Webpack file I included my ScrollMagic calls after ScrollMagic. I have even gone as far as removing my custom.js from the Webpack build and having two separate files: libs.js and init.js. However, I still get the same error when calling: |
@OfficialYoungX, thank you for your input. I too realize I can add GSAP and ScrollMagic with script tags and CDN. This isn't my goal. My goal is to have it included in my build process for a single JS file. |
You can import the library directly in the file and it works perfectly:
|
Review the following > #324 |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.3/ScrollMagic.js"></script> This works for me. @random-yang Thanks |
Worked for me tooo...thanks youuuuuuu |
Repo with issue: https://[email protected]/gphilp/ihatetomatoes.git
foundation watch
Error:
Uncaught ReferenceError: ScrollMagic is not defined
Any help resolving this would be greatly appreciated.
I thought the error might have had something to do with jQuery. So I tested ScrollMagic.Controller outside of any jQuery reference and still get the same not defined error.
Is the issue created because the new ScrollMagic.Controller triggering before ScrollMagic has fully loaded? This shouldn't be the issue though since ScrollMagic and plugins come before the Controller init.
So far I have successfully added ScrollMagic, animation.gsap, and debug with webpack by using the alias config within the gulpfile.
Site structure:
The text was updated successfully, but these errors were encountered: