Jump to content
Search Community

importing registering scrolltrigger

JamesGrubb test
Moderator Tag

Recommended Posts

Hello having an issue where a local build is working but the Netlify built site is showing a resource not found error. Wondered if someone could check my code please.

 

//scripts.js
gsap.registerPlugin(ScrollTrigger)
const tl = gsap.timeline()
const q = gsap.timeline({ defaults: { duration: 2 } })
const items = document.querySelectorAll('.item')
tl.from('header', {
    y: "-100%", scrollTrigger: {
        trigger: 'header',
        // markers: true,
        start: "300px, 10%",
        end: "200px, -200px",
        scrub: 1
    }
}
)

my index.html links to scripts in the following order 

//The {% version %} is a nunjucks shortcode to create a random number to force a cache refresh
<script src="/js/scrollTrigger.js?v={% version %}" defer></script>
  <script src="/js/gsap.js?v={% version %}" defer></script>
  <script src="/js/scripts.js?v={% version %}" defer></script>
  <script src="/js/alpine.js?v={% version %}" defer></script>

Thanks in advance

Link to comment
Share on other sites

ES6 imports? It looks like you're just trying to load things a script tag? 

 

Check to make sure yoursite.com/js/scrollTrigger.js works because that is the path that you're giving it (and same thing for your other resources).

 

If it doesn't, I'd reach out to Netlify's support. I'm sure they'd be able to help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...