lundi 24 juin 2019

Dropdown menu click-outside

I have a button (hamburger menu) and a dropdown menu just beneath him. When I click on my hamburger button, I want my dropdown menu who appears. And when I click outside my dropdown menu I want them to disappear... logic ever since.

But my button who triggers the appearing is also outside the dropdown menu ... so if I put an event on the dropdown clickoutside, my button will never be triggered (click event + clickoutside dropdown => nothing happens)

So how can I do that?

Aucun commentaire:

Enregistrer un commentaire