我有这个网站检查光标是否在元素的父
<div class='parent'>
<div class='child'></div>
</div>
我想添加一个鼠标悬停和鼠标移开事件parent
元素,但问题是当光标悬停child
elemet它触发mouseout事件虽然acually仍在parent
元素内。 我该如何避免这种情况,只有在光标离开parent
项目时才会触发mouseout事件。
$(body).on('mouseover', '.parent' , function(){ /* do somthing */});
$(body).on('mouseout', '.parent' , function(){ /* do another somthing */});
可以添加你的CSS代码?在父级添加显示块并检查 – 2015-02-09 12:45:40