how to hide nav bar when user scroll down

Hello all ,   In my project I need to make the nav bar transparent so the carousel I have should be the background for  the menu bar and that’s work fine with position and z-index , but the problem I have when user scroll down the nav still appear , I try to use HTMlsnippet to solve that in JS and doesn’t work also I try to give all below element high z-index and still appear the nav    have any one deal with same situation maybe help me or give me new ideas to do that
1 answers

I guess you are trying the below solution. If you have custom Navbar and id hardcoded, this might work.


But if you are mendix top-bar navigation, you can use getElementByClassName(‘region-topbar’) would solve the problem. Also you need to change the CSS from #navbar to .region-topbar