开发者

Why does .mouseOut() fire when hovering over text inside the mouseOut target?

For example, if I do $('div#something').mouseout(function(){}); then the function will fire when I hover on text that is inside the #something div instead of when I leave the div.

I want it 开发者_Python百科to fire only when I leave the div, not when I hover over text inside the div.

Why is this happening?


mouseout fires whenever the mouse cursor leaves an element, even if "leaving" means it is entering a child element (which the text would be - at least on some browsers).

You may want to use "mouseleave" instead.

http://api.jquery.com/mouseleave/


mouseOut fires when the mouse leaves an element - and that includes when it moves onto its child elements. See this jsFiddle: http://jsfiddle.net/minitech/kZcCr/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜