admin管理员组文章数量:1335407
I have list of images, on over on image i want to show some information on that image. And mouseout of the info div, same should disappear. Problem is when mouse moves on child tag of info div it fires mouseout even, which should not. And i am using normal JavaScript.
<div id="pop_div" onmouseout="clearinfo()" >
<img alt="" src="" />
<p>lines of text</p>
</div>
function clearinfo()
{
document.getElementById("pop_div").style.dispaly = "none";
}
I have list of images, on over on image i want to show some information on that image. And mouseout of the info div, same should disappear. Problem is when mouse moves on child tag of info div it fires mouseout even, which should not. And i am using normal JavaScript.
<div id="pop_div" onmouseout="clearinfo()" >
<img alt="" src="" />
<p>lines of text</p>
</div>
function clearinfo()
{
document.getElementById("pop_div").style.dispaly = "none";
}
Share
Improve this question
edited Jul 20, 2009 at 4:15
munity wiki
2 revs, 2 users 73%
vinay 2
- Why was this post made munity wiki? – rahul Commented Jul 20, 2009 at 4:20
- You won't get answers because people don't get points on a cWiki... – James Commented Jul 20, 2009 at 6:35
2 Answers
Reset to default 5You can emulate behavior of mouseleave event:
<div id="pop_div" onmouseout="if ((event.relatedTarget || event.toElement) == this.parentNode) clearinfo()" >
<img alt="" src="" />
<p>lines of text</p>
</div>
That is the behavior of mouseover. If you were using jQuery however, you could use mouseenter/mouseleave events.
本文标签: javascriptpreventing mouseout event for child nodeStack Overflow
版权声明:本文标题:javascript - preventing mouseout event for child node - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742385742a2464997.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论