当鼠标已经位于元素onLoad上时,带有.toggle()的jQuery MouseEnter和MouseOut事件会反转吗?

我有一个下拉菜单,可以很好地与以下代码配合使用:

$('#menu ul li').mouseenter(function(){
    $(this).children(".dropdown").toggle();
}).mouseleave(function(){
    $(this).children(".dropdown").toggle();
});

正如您所期望的那样.问题是,如果在$(document).ready(function(){})被触发时,鼠标已经在$(‘#menu ul li’)上进行鼠标输入,则切换是否可以正常进行?

如何避免这种情况?

EG:http://screenr.com/wbd

最佳答案
您是否不想在mouseenter上执行show()而在mouseleave上执行hide()?

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...