Jump to content

Alexander S.

Hide Hamburger on scroll problem

Moderator Tag
Go to solution Solved by OSUblake,

Recommended Posts

Hello everyone!


I got a hamburger menu that hides and shows on scroll up/down, using code from another forum post. Using ScrollTrigger.matchMedia I am limiting this behavior to mobile devices only (larger screen size set in the demo to demonstrate behavior more easily).


How do I make the hamburger stay in place when the menu is open? Currently is scrolls out of the way even if the menu is open, which isn't very userfriendly.


Any help would be greatly appreciated!


See the Pen abVrZqE by aStingl (@aStingl) on CodePen

Link to comment
Share on other sites

  • Solution

Hi Alexander,


You can put a condition inside your onUpdate to return if it's open.


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


  • Like 2
Link to comment
Share on other sites

Thank you so much! You are indeed a Superhero! :D

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