Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
33
rated 0 times [  37] [ 4]  / answers: 1 / hits: 22365  / 4 Years ago, tue, december 8, 2020, 12:00:00

i wanna build a menu that is shown on mouseover and displays elements:
category:
- sub-category1
- sub-category2


I managed to accomplish that, but my problem is that when i hover over the menu and it shows the elements inside and i move the mouse away from the menu itself, the elements dont hide.


Here is my code:


<div x-data="{open: false}">
<button @mouseover="open = true">Category</button>
<div x-show="open" @mouseout="open = false" class="h-80 bg-red-900">
<ul>
<li>Sub-category 1</li>
<li>Sub-category 2</li>
</ul>
</div>
</div>

More From » html

 Answers
17

use @mouseover.away = "open = false" on the outside div


[#50495] Monday, November 23, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
paolam

Total Points: 437
Total Questions: 107
Total Answers: 106

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
;