我尝试使用 $("element").trigger("mouseenter") 手动触发 mouseenter 事件。它在除 IE8 之外的所有浏览器中都能正常工作。
<html><head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<meta charset="utf-8">
</head>
<body>
<div id="box" style="border:5px solid red;width:100px;height:100px">
</div>
<script>
$(function(){
$("#box").mouseenter( function(event){
console.log("mouseenter triggered!!");
});
$("#box").trigger("mouseenter");
//$("#box").mouseenter();
});
</script>
</body></html>