當我將鼠標移出子菜單時,它會向上滑動,但是如果從主菜單中將鼠標移出而不關注子菜單,則不會。 這裏是我的代碼子菜單不會在主菜單的mouseleave上滑動
$('.dropdown').mouseenter(function() {
$('.sublinks').stop(false, true).hide();
var submenu = $(this).parent().next();
submenu.css({
position: 'absolute',
top: $(this).offset().top + $(this).height() + 'px',
left: $(this).offset().left + 'px',
zIndex: 1
});
submenu.stop(true,
true).slideDown(300);
submenu.mouseleave(function() {
$(this).slideUp(300);
});
});
HTML的
<ul id ="ul1" >
<li><a href="#" class="dropdown"></a></li>
<li class="sublinks">
<table cellpadding ="0" cellspacing ="0">
<tr>
<td><a href="Product1.aspx">Product 1
</a></td>
</tr>
<tr>
<td><a href="Product2.aspx">Product 2</a></td>
</tr>
<tr>
<td><a href="Product3.aspx">Product 3</a></td>
</tr>
<tr>
<td><a href="Product4.aspx">Product 4</a></td>
</tr>
<tr>
<td><a href="Product5.aspx">Product 5</a></td>
</tr>
<tr>
<td><a href="Product6.aspx">Product 6</a></td>
</tr>
</table>
</li>
</ul>
你有它的任何在線版本嗎? – Aristos