Need flyout menu to default to closed on mobile

Hi there everyone!

https://scotchandiron.org/fivemin/1.html

I’ve got a menu that remembers the flyout position and on desktop/tablet, that’s perfect. The issue I have is that the menu defaults to open on mobile page load. It closes as soon as I start scrolling the page but I need it to be closed on page load.

I could use PHP to detect mobile and change the attributes of the menu but I’m wondering if there’s something I can do that would manage the state of the menu natively in css.

Any help would be greatly appreciated. Thanks for your time!

so… something in your code already detects mobile?
so… use the same detector to close on load?

Thanks for your help!

That is what I’ll do if there’s no simple solution to the CSS handling that.

Your request would be more helpful if you showed us the code. (The garage mechanic would say, “bring your car in so I can look under the hood.”)

Hi there Steve, I posted the link above so the source could be viewed. Since the menu uses different elements throughout the HTML and CSS as well as js, I thought that would be the most useful way to share the code.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.