Opera e IE 中的鼠标悬停
我有这个法典,适用于 jquery e rapahel_jquery。这是一个带有一些鼠标事件的函数。 IE 和 Opera 的鼠标移出问题。 这是从法典中推断出来的:
for (var province in ita)
{
(function (prov, province)
{
prov.color = Raphael.getColor();
prov.scale(2.5, 2.5);
}); //close mouseover
prov.mouseout(function()
{
alert('ciao');
prov.scale(1, 1);
}); //close mouseout
prov.mousedown(function()
{
dialog($alfa); // calling the function dialog
}); //close mousedown
}); //close function (prov, province)
}
所有的作品,但不是 prov.mouseout 与 IE 和 Opera!为什么??你能帮助我吗??
谢谢!
I have this codex, that works with jquery e rapahel_jquery. It's a function with some mouseevents. Problem with mouseout for IE and Opera.
This is extrapolate from the codex:
for (var province in ita)
{
(function (prov, province)
{
prov.color = Raphael.getColor();
prov.scale(2.5, 2.5);
}); //close mouseover
prov.mouseout(function()
{
alert('ciao');
prov.scale(1, 1);
}); //close mouseout
prov.mousedown(function()
{
dialog($alfa); // calling the function dialog
}); //close mousedown
}); //close function (prov, province)
}
All works, but not prov.mouseout with IE e Opera!!! why?? Can you help me??
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你正在使用 jQuery 吗?尝试使用 mouseleave 而不是 mouseout。
mouseleave 是一个仅适用于 IE 的 javascript 事件。现在,jQuery 对 mouseleave 的解释与 mouseout 的版本略有不同。
当鼠标移出它所绑定的元素时,jQuery mouseleave 就会被触发。
当鼠标移出它所绑定的元素时,或者当鼠标移出该元素的任何后代元素时,jQuery mouseout 就会被触发。
我不明白为什么你会想要检测后代元素的 mouseout,所以这就是为什么我对所有事情都使用 jQuery mouseleave 而从不为 mouseout 烦恼的原因。
另外,也许这个 jquery e rapahel_jquery 库使用旧版本的 jQuery,如果您能够使用较新的版本,也许这个 Opera/IE 错误会得到纠正?我仍然会尝试 mouseleave,因为(据我所知,无需查看 jQuery 源代码)它使用完全不同的功能来完成类似类型的操作,并且旨在复制仅限 IE 的事件。
you are using jQuery? Try mouseleave instead of mouseout.
mouseleave is an IE-only javascript event. Now, jQuery's interpretation of mouseleave works slightly different than their version of mouseout.
jQuery mouseleave is triggered when the mouse goes outside of the element it is tied to.
jQuery mouseout is triggered when the mouse goes outside of the element it is tied to, or also when the mouse goes outside any of that element's descendent elements.
I don't see why you would ever want to detect mouseout of descendant elements, so this is the reason why I use jQuery mouseleave for everything and never bother with mouseout.
Also, maybe this jquery e rapahel_jquery library uses an older version of jQuery, and if you were able to use a newer version maybe this Opera/IE bug would have since been corrected? I would still try mouseleave because (as far as I can tell without looking in to the jQuery source) it uses entirely different functionality to accomplish a similar type of action and it was intended on replicating an IE-only event.