Jump to content
Search Community

onEnterBack not working as aspected

gianlucas90 test
Moderator Tag

Recommended Posts

Hello guys, I am fairly new to GSAP, but I'm loving it really much!

I am trying to reproduce something similar to the codepen attached.

The issue is the following (it's happening in your codepen as well):

When you scroll to the first panel (blue) and then try to come back to the first one (white), without passing the end point which is at the top of the window it does not take you back to the y:0 but it lets you free to scroll. 

The same strange behaviour is not happening for the following pannels (e.g. red and blue).

I have also noticed that in chrome the problem is happening when I preview it with the Chrome Dev tool in responsive mode, while is not happening if I select a device.  

thank you very much!

Gianluca

See the Pen rNLOdbB by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

 

Hey @gianlucas90 - welcome to the GSAP forums.

 

2 hours ago, gianlucas90 said:

When you scroll to the first panel (blue) and then try to come back to the first one (white), without passing the end point which is at the top of the window it does not take you back to the y:0 but it lets you free to scroll. 

 

I am not 100% sure I understand what it is you are saying.

 

Do you mean that it doesn't work for the white part on top when scrolling back up to it as it does for the other sections?

That is to be expected, because the white part is a div that doesn't have the class of panel which would be neccessary for it to work like the other sections - thus it doesn't have a ScrollTrigger with an onEnterBack-callback.

 

Ideally for semantic consistency make it a section too and add the panel class to it and it should work.

But maybe I am just misunderstanding. Is this what you were after?

 

See the Pen beea58cb351ec98a9290fbdb20f7b562 by akapowl (@akapowl) on CodePen

 

  • Like 1
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...