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>
I don't answer or check forum DMs, please just post on the forum.
Before you post:
Use the Search Feature. Maybe there is already a solution to your issue.
1. Update Lay Theme and all Lay Theme Addons
2. Disable all Plugins
3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
4. Now see if your problem solved itself
5. Go here, see if your problem is listed here:
Troubleshooting
When you post:
1. Post a link to where the problem is
2. If the problem is difficult to explain, post screenshots / link to a video to explain it