Jump to content
Search Community

Pin navigation to side of the screen in layered setup

Tomas100 test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hello!

I am making a website like in the codepen. I have the layers functional but I can not figure out how to pin a navigation bar to the side of the screen which would be on top of all the layers sliding on top of each other. So far I have only managed to pin the navigation to the first layer while the second layer is sliding on top of it making it invisible. 
Please let me know if you have any suggestions :)

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

Link to comment
Share on other sites

Thx for the reply Rodrigo!

I have managed to make it work but I want to add a ScrollSmoother as well. As soon as I add ScrollSmoother the navigation is sliding away together with a layer . Is there a way to fix it together with ScrollSmoother? 

Thank you!

Link to comment
Share on other sites

 

9 hours ago, Tomas100 said:

As soon as I add ScrollSmoother the navigation is sliding away together with a layer . Is there a way to fix it together with ScrollSmoother? 

 

Here's an explanation for why that happens, and suggestions for how to work around that, from the documentation, @Tomas100

 

https://greensock.com/docs/v3/Plugins/ScrollSmoother

 

Caveats

  • position: fixed should be outside the wrapper - since the content has a CSS transform applied, browsers create a new containing block and that means position: fixed elements will be fixed to the content rather than the viewport. That's not a bug - it's just how CSS/browsers work. You can use ScrollTrigger pinning instead or you could put any position: fixed elements OUTSIDE the wrapper/content.

 

  • Like 2
Link to comment
Share on other sites

  • Solution

Yep, @akapowl is right, you need to set your fixed elements outside the smoother container:

<div id="smooth-wrapper">
  <div id="smooth-content">
    <!--- ALL YOUR CONTENT HERE --->
    </div>
</div>
<!-- position: fixed elements can go outside --->

Here is a fork of that codepen example using ScrollSmoother so you can see it in action:

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

 

Hopefully this clear things up. Let us know if you have more questions.

Happy Tweening!

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