在IE9中将鼠标悬停在精灵图像上时悬停不活动

时间:2012-09-26 14:29:00

标签: html css internet-explorer hover css-sprites

这是一个坚韧的人。

JSfiddle

我有一个打开视频播放器的链接(见下文)。同位素水文图像是链接图像,播放按钮图像在span内作为背景图像。

enter image description here

我正在使用css精灵,以便当有人在图像的任何部分上空盘旋时,播放图像将变为下面的内容。

enter image description here

除了IE之外,所有浏览器都可以正常使用。在IE9中,当我将鼠标悬停在同位素水文图像上时,它会改变颜色并且是可点击的(如上图所示)。但当我将鼠标悬停在实际播放按钮上时,它会从蓝色的“活动”播​​放按钮(上方)切换到灰色的“非活动”播放按钮(顶部图像),并且无法点击。

我创建了下面的图片来说明正在发生的事情:

enter image description here

这是当你将鼠标悬停在同位素水文图像上时(这就是我想要发生的事情)

enter image description here

一旦我将鼠标悬停在播放按钮(这是一个跨度背景图像)上,就会出现这种情况。(光标变为文本光标,css精灵变回非悬停颜色)

对此的任何帮助都会很棒。

这是html:

<div id="news-video" class="news-tab">
                        <div id="video-box-left">
                            <div class="video-img">
                                <a href="#" onclick="window.open('http://wwwindex.html','photoessay','scrollbars=no,resizable=yes,width=850,height=722')"><span class="video-play-q-left">play</span><img src="resources-na/images/video-amano-scientific-forum.PNG" alt="Isotope Hydrology - The Fingerprints of Water" width="200" height="155" border="1"></a>
                            </div>
                            <div class="video-text">
                                <p><strong>Food for the Future - Meeting Challenges with Nuclear Applications - Statement to 2012 Scientific Forum</strong><a href="#" onclick="window.open('http://www-','photoessay','scrollbars=no,resizable=yes,width=850,height=722')"></a></p>
                            </div>
                        </div>
                        <div id="video-box-right">
                            <div class="video-img">
                                <a href="#" onclick="window.open('http://www-','photoessay','scrollbars=no,resizable=yes,width=800,height=600')"><img src="resources-na/images/video-isotope-hydrology.jpg" alt="Isotope Hydrology - The Fingerprints of Water" width="200" height="155" border="1"><span class="video-play-q-right">play</span></a>
                            </div>
                            <div class="video-text">
                                <p><strong>Isotope Hydrology - The Fingerprints of Water</strong><a href="#" onclick="window.open('http://.html','photoessay','scrollbars=no,resizable=yes,width=850,height=722')"></a></p>
                            </div>
                        </div>

这是css:

#news-video {
    color: #8A8A8A;
    font-size: 1.1em;
    line-height: 1.6667;
    padding-left: 0px;
}

#video-box-left{
    margin-left: 10px;
    margin-right: 20px;
    float: left;
    width: 210px;
}
#video-box-right{
    margin-right: 10px;
    float: left;
    width: 210px;
}
.video-img {
    background-color: #EEEEEE;
    border: 1px solid #DDDDDD;
    margin-bottom: 5px;
    padding: 4px;
    width: 200px;
    height: 155px;
}

.video-text {

}

.video-play-q-left {
    background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
    background-position: center top;
    height: 50px;
    position: absolute;
    text-indent: -9999em;
    width: 50px;
    left: 100px; 
    top: 127px;
}
.video-play-q-right {
    background: url("../images/video-play-q-big.png") no-repeat scroll 0 0 transparent;
    background-position: center top;
    height: 50px;
    position: absolute;
    text-indent: -9999em;
    width: 50px;
    left: 321px;
    top: 127px;
}

a:hover .video-play-q-right{
    background-position: center bottom;
}

a:hover .video-play-q-left{
    background-position: center bottom;
}

1 个答案:

答案 0 :(得分:0)

我的DOCTYPE标签迫使IE进入“IE9兼容性视图”。

我改变了标签,很好。

感谢大家的帮助。