Hello,
I have this code with TailwindCSS.
@props([
'title',
'active',
])
<li
x-data="{ show: false }"
@mouseover="show=true"
@mouseout="show=false"
class="top-0 h-[56px] group"
>
<div class="relative transition-all h-full flex justify-center rounded-b-lg whitespace-nowrap px-5 pt-[8px] pb-[12px] text-lg group-hover:h-[60px] group-hover:pt-[14px] cursor-pointer {{ $active ? 'bg-primary text-white' : 'text-secondary group-hover:bg-lightgray group-hover:text-black' }}">
{{ $title }}
<div class="absolute top-[72px]" x-transition x-show="show">
<div class="relative flex justify-center">
<div class="absolute h-4 w-4 rotate-45 bg-darkgray"></div>
<ul class="absolute top-2 py-3 rounded-lg bg-darkgray text-white">
{{ $slot }} // list of li
</ul>
</div>
</div>
</div>
</li>
When I move the mouse over the submenu title, the submenu appears.
Then I move the mouse down to the submenu to select a submenu item. But the submenu disappears before I get the submenu items block. Yet the submenu is inside the li tag.
What I need is that a long as the mouse is inside the li tag, the submenu remains visible.
Why does my code not apply this behavior ?
I have added a border to see the limit of the li tag and it's bordered only around the text of the li, the submenu is outside the li border. Why ?
Thanks for your help.
V