When the mouse stays over the slide
div, the slide_panel
div will become visible.
However, when the mouse then exits the slide
div and is over the content in the slide_panel
, the panel does not remain visible.
So, once the panel is initially visible, how do you keep the toggled panel visible on mouseover
?
<div class = "slide">category:</div>
<div class = "slide_panel">
<a href = "#" title = "">asdf</a><br />
<a href = "#" title = "">qwerty</a><br />
</div>
<div class = "slide">another category:</div>
<div class = "slide_panel">
<a href = "#" title = "">another asdf</a><br />
<a href = "#" title = "">another qwerty</a><br />
</div>
jQuery:
$(".slide").mouseover(function() {
$(this).next(".slide_panel").slideToggle();
}).mouseout(function() {
$(this).next(".slide_panel").slideToggle();
});
slide_panel
to then disappear on mouseout
, to essentially behave like a dropdown menu.
If you can wrap your submenus under your main menu you can avoid this issue.
<div class="slide">category:
<div class="slide_panel"> <a href="#" title="">asdf</a>
<br /> <a href="#" title="">qwerty</a>
<br />
</div>
</div>
<div class="slide">another category:
<div class="slide_panel"> <a href="#" title="">another asdf</a>
<br /> <a href="#" title="">another qwerty</a>
<br />
</div>
</div>
$(".slide").on('mouseenter mouseleave', function () {
$(this).find(".slide_panel").stop().slideToggle();
});