How to keep menu open after :active

Asked

Viewed 392 times

0

I have a menu made exclusively with css and html. When clicking the button it opens the menu, but if I release the button it disappears, to keep the menu open I need to be holding the mouse button. I wanted opinions on how I can fix this, just click once and open the menu and continue open and if I move the mouse pointer to the navbar it disappears normally.

Details on codepen website: https://codepen.io/flashpremium/pen/zzYKBR

1 answer

1


Try swapping :active for :Hover. I tested in codepen on line 63 of your css

.top-menu > li:hover .megadrop {

I don’t know if that’s the result you were expecting.

I hope I’ve helped :)

  • Thanks for the tip, but had already tried this way, only I intend to open the menu only after clicking the button.

  • Do you want a menu like this? https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_dropdown_navbar_click

  • Yes, just like that.

  • Can you use javascript? In the example I gave you you need javascript to activate the menu. Still need help to adapt your code to the example?

  • Thanks for the tip, I will use the example above to adapt in the menu.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.