Jump to content
Search Community

ScrollTrigger last trigger not reachable

steef test
Moderator Tag

Recommended Posts

Hi there :)
I'm working on an in-page side navigation
that shows the active nav item based on the current content that is visible.
This can be triggered by scrolling on the page or clicking on the nav item. 

This page will, eventually, contain dynamic content. In some cases the first/last item of the content section will contain only little text.

This causes the issue that I can not trigger the nav item to get active because the panel does not get triggered.
Is there a way how to fix this?

(the issue is only visible on screens that are higher than the codepen example below)

Thanks in advance!


 

Screenshot 2022-12-20 at 21.42.40.png

See the Pen VwBYLeX by Steef (@Steef) on CodePen

Link to comment
Share on other sites

Hi @steef and welcome to the GreenSock forums!

 

Sorry for the late response 🙏

 

This is something that would require quite a bit of logic to accommodate every single scenario and on top of that be fully responsive. The easiest way I can think of is to add an extra element at the bottom of the panels and give that element the height of the screen minus the height of the last panel (I added a very distinctive color so you can see it clearly). On top of that tinker a bit with the start and end points in order to put them at the top of the viewport in order to match the left sidebar links.

 

Here is a live example:

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

 

Hopefully this is helpful. Let us know if you have more questions.

 

Happy Tweening!

  • Like 1
Link to comment
Share on other sites

Hi Rodrigo, thank you for your response (which in my opinion was fast 😼)  and trying to find a solution with me.
Since there is no - fairly easy - solution for this I think I'll go with adding some extra space ;)

Have a lovely day!
 

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