How do I make a secondary menu stick to the top of the page when you scroll past it?


#1

Hello. I am looking to have a secondary menu halfway down the page that sticks to the top when you scroll past it. Example is here: https://www.hubspot.com/instagram-marketing. Template is here: http://www-apexhomeloans-com.sandbox.hs-sites.com/buying-a-home. Basically I just want a menu to behave the same way as on the instagram-marketing page (hamburger menu for mobile would be fine).


#2

Hi @apex,

You could try something like this, where once the element has scrolled a certain distance you use javascript to change the class of the menu (or in the case of the example I linked to, the search bar).