jquery - Mouseenter 仅在 IE9 中的透明 div 边框上触发

标签 jquery internet-explorer mouseover mouseenter

在我的代码中,我有一个 id 为“SIAinfoBox”的 div,根据鼠标当前所在的 div 来加载不同的详细信息。我将以下两个监听器附加到每个相关的 div:

$(annoDiv).mouseover(function(event){
                event.stopPropagation;
                $('#SIAinfoBox').empty();
                $('#SIAinfoBox').append(details);
                $('#SIAinfoBox').css('visibility','visible');
            });
$(annoDiv).mouseleave(function(event){
                event.stopPropagation;
                $('#SIAinfoBox').empty();
                $('#SIAinfoBox').css('visibility','hidden');
            });

这些 div 没有设置背景颜色,但有 1 像素的纯黑色边框。在 Firefox 中,一切都运行良好。但在 Internet Explorer 中,仅当鼠标位于 div 边框上方时,SIAinfoBox 才会被填充。将其移动到 div 内似乎会触发 mouseleave 事件,并且内容将被删除并隐藏 div。如果我设置背景颜色,它会像预期的那样工作,但是如果没有背景颜色(或透明),它就不起作用。我也尝试过使用 mouseenter 而不是 mouseover,但结果相同。 为什么 InternetExplorer 会有这样的行为,或者我可以采取什么措施来实现我目前在 FF for IE 中获得的结果?

最佳答案

I've had similar IE related issues such as this - you could make a transparent png and set the background to "url(images/transparent.png) repeat scroll 0 0 transparent" – SmokeyPHP

首先没有找到他的评论,所以我将其移至此处作为答案。可以通过以下链接找到透明图像:

答案: style="background:url(images/transparent.png) 重复滚动 0 0 透明"

透明gif: http://www.golivetutor.com/download/spacer.gif

关于jquery - Mouseenter 仅在 IE9 中的透明 div 边框上触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7799459/

相关文章:

javascript - 以编程方式设置多选中的选定选项

html - 为什么IE11会给出这个警告: HTML1406: Invalid tag start: "<?"

html - ie7-8 不渲染图像宽度为 : 100% 的包装器

javascript - 在鼠标悬停时显示/隐藏 jQuery 对话框

events - MouseOver 的 JqPlot 事件

javascript - 当表中没有记录时如何提供警报?

javascript - 无法更改链接的标题属性

javascript - 在函数运行之前等待计时器完成

c++ - 从进程外,从 IE 实例获取 IWebBrowser2 接口(interface)的正确方法是什么?

css - 如何仅在鼠标悬停时连续显示按钮?