Jump to content
Search Community

Scrollto - how to enable a user to scroll back up past a trigger point?

Ritch.b test
Moderator Tag

Go to solution Solved by Ihatetomatoes,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

In my codepen I am using ScrollMAgic to trigger a scrollto. The issue is when you scroll back up, it triggers again and forces you back down. How do I disable the trigger, but only in the up direction?

 

What I mean by this is, I want to disable the trigger when a user scrolls up, but have it fire again when a user scrolls down.

 

Thanks

See the Pen rLyajL by Ritch (@Ritch) on CodePen

Link to comment
Share on other sites

Hi Ritch, have you tried to add reverse: false to the Scene options?

ScrollMagic.Scene({
  triggerElement: '.trigger',
  triggerHook: 'onLeave',
  reverse: false
})
.addIndicators()
.addTo(controller)
.setTween(menurb);

This should only trigger your animation once.

 

Hope that helps.

  • Like 1
Link to comment
Share on other sites

Hey thanks for your response Petr and also thanks for creating all of your video tutorials! 

 

I havn't tried that, as I want the animation to run multipule times and to reverse, but if it's possible - to only trigger the scrollto animation when a user moves from top to bottom. So if a user moves back up the page, the scrollto is ignored. Is this even possible?

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