html - IE7/8 : div loses :hover if mouse moves over an iframe which is inside the div!

标签 html css iframe hover

我正在尝试在列表中添加 facebook“like button”和 twitter“tweet button”,我的列表结构是:

<list>
    <listItem>
        <iframeContainer>
            <iframe/>
        </iframeContainer>
    </listitem>
</list>

CSS 是:

listItem iframeContainer {display:none;}
listItem:hover iframeContainer {display:block;}

IE7/8:问题是当鼠标移到 iframe 上时 listItem 失去焦点。

我试图通过 csshover.htc 修复它,但它没有修复它。

它在其他浏览器中工作正常。

你可以在这里现场查看:
http://bit.ly/hsFtq6
您需要在网站上注册,这既简单又快速:)

谢谢

最佳答案

我已经用与 csshover.htc 相同的方法修复了它,尽管添加 csshover.htc 并没有修复它!

if($.browser.msie){
     $('.item').live('mouseenter',function() {
        $(this).addClass('hover');
     });
     $('.item iframe').live('hover',function() {
        $(this).parents(".item").addClass('hover');
     });
     $(".item").live('mouseleave',function() {
        $(this).removeClass('hover');
     });
}

CSS:

.item:hover, .item.hover {background-color:#555;}

关于html - IE7/8 : div loses :hover if mouse moves over an iframe which is inside the div!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4507388/

相关文章:

html - 设置三行布局的正确高度尺寸

javascript - 基于内联 CSS 样式或跨文本的 Jquery 选择器

c# - 内容被阻止,因为它没有由有效的安全证书签名。

javascript - iframe src 属性随参数变化

javascript - 在 iframe 中加载脚本

javascript - jquery 按内容更改动态创建的表格的颜色

html - Pentaho reportviewer URL 未在 iframe 中加载

php - 我的电子商务购物车中的产品数量没有更新

javascript - 在 highcharts 样式模式下按父节点着色 TreeMap

html - 使CSS框从四面八方旋转