Jump to content
Search Community

Has anyone lost their pin-spacer between local and staging/prod?

DevC test
Moderator Tag

Recommended Posts

In lieu of full demo, throwing this out there if it's been seen before. Happy to make a demo if this is not enough context.

Have you seen this and what was the issue? gsap and scrolltrigger are both loaded and running, but no pin-spacer.

Link to comment
Share on other sites

Ah it looks like I've done something wrong with my media query, but I can't quite see it. I can get pin-spacer to appear if I load the page in mobile view first then switch to desktop view. Very odd behavior. As you can see below I want to kill any pinning below 655px.

 

  useEffect(() => {
    // Scroll Scenes
    ScrollTrigger.matchMedia({
      '(min-width: 655px)': function () {
        const scenes = gsap.utils.toArray('#mediaObject')

        // maybe use dymanic height for pin/scroll ends?
        const height = (scenes.length - 1) * 200 + '%'
        // Scenes Timeline
        const pinTl = gsap.timeline({
          scrollTrigger: {
            trigger: wrapRef.current,
            pin: listRef.current,
            start: 'center center',
            end: `+=${height}`,
            scrub: 1,
            anticipatePin: true,
          },
        })
      },
    })
  }, [])

 

Link to comment
Share on other sites

Yep, that looks like it's only going to happen on viewports 655px wide and above. But you're saying that you see the opposite? You see the ScrollTriggered timeline running only on screens BELOW that size? Something sounds wrong here, but we cannot effectively troubleshoot without a minimal demo🤷‍♂️

 

You must have other code elsewhere that is affecting things. 

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...