Hide mobile menu, when scrolling down
-
Hey ,
I want to know if its possible to hide the mobile menu bar when you scrolling down?
I know where i can add the JS for that but i dont know the HTML class i need to address, to remove the menu bar when u scrolling down on your mobile device.
Would be great if one of u could share some ideas or maybe had the same problem before.
Thank you
best regards
Schmarcopolo
-
Dear @schmarcopolo
Could you please post a link to your website and i can take a better look :)
Sincerely
Richard -
Hi Guys,
same topic. Want to hide site titel and Navbar when scrolling on mobile (like it is on Desktop) using this script below:
But can't address the right class(?). What I doing wrong?
Link to website
https://truestedt.albrechtgaebel.de/Thx
<script> var prevScrollpos = window.pageYOffset; window.onscroll = function() { var currentScrollPos = window.pageYOffset; if (prevScrollpos > currentScrollPos) { document.getElementById("navbar").style.top = "0"; } else { document.getElementById("navbar").style.top = "-50px"; } prevScrollpos = currentScrollPos; } </script>```
-
navbar doesnt have the id navbar but the class navbar
you could just do jQuery('.navbar').css('transform', 'translateY(-100%)');
-
@arminunruh
where, how, what can i enter, that the mobile-menue hides ? -
@Ludwig said in Hide mobile menu, when scrolling down:
where, how, what can i enter, that the mobile-menue hides ?
hey theres no lay theme built in way for the mobile menu to hide on scroll
i think @albrecht might have used this code to make it work not sure
<script> var prevScrollpos = window.scrollY; window.onscroll = function() { var currentScrollPos = window.scrollY; if (prevScrollpos > currentScrollPos) { document.querySelector(".navbar").style.top = "0"; } else { document.querySelector(".navbar").style.top = "-50px"; } prevScrollpos = currentScrollPos; } </script>
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it