“onmouseover”出现问题使用原生 Javascript 的事件
我正在尝试将 onmouseout
函数添加到以下小部件中的名称。 onmouseover
工作正常,但 onmouseout
几乎在鼠标悬停时立即触发。不知道为什么。
我认为它可能与“冒泡”有关,我一直在尝试阅读有关该主题的内容,但不太理解其中的含义。
任何帮助表示赞赏。
I am attempting to add an onmouseout
function to the names in the following widget. The onmouseover
works fine but the onmouseout
fires almost immediately on rollover. Not sure why.
I think it may have something to do "bubbling" and I have been trying to read about the subject but don't quite understand the implications.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的鼠标悬停处理程序正在破坏处理程序所附加的
。调整您的代码,以便将处理程序附加到永久元素,方法是附加到不同的元素或不破坏您正在使用的元素。
Your mouseover handler is destroying the
<a>
which the handlers are attached to. Adjust your code so that the handlers are attached to a permanent element, either by attaching to a different element or not destroying the one you are using.