1

我有一个网站页面,我试图让辅助图像在鼠标悬停或单击时覆盖主图像。图像叠加动作由主图像上的热点触发。该代码适用于 Chrome、Safari、Firefox 和 Opera,但不适用于 IE?有谁知道为 IE 更正它的方法?

网页: http: //www.neurobalancingcenter.com

样式代码:

<style type="text/css">
.imgoverlay 
{
position:absolute;
margin: 10px 0 0 487px;
}
</style>

JavaScript 代码:

<script type="text/javascript">
$(document).ready(function () {
    $('.jkimagelarge').hover(
       function () {
           $('.pic').prepend('<div class="imgoverlay"><img src="' + $(this).attr('pic') + '" /></div>');
       },
       function () {
           $('.imgoverlay').each(function () { $(this).hide(); });
       }
    );
});

</script>

正文代码:

<div class="pic">
<map id="FPMap0" name="FPMap0">
<area coords="508, 227, 738, 252" href="#" pic="/images/what_is_bwo.jpg" shape="rect" class="jkimagelarge" />
<area coords="508, 252, 726, 279" href="#" pic="/images/why_bwo.jpg" shape="rect" class="jkimagelarge" />
<area coords="508, 279, 667, 300" href="#" pic="/images/how_bwo.jpg" shape="rect" class="jkimagelarge" />
</map>
<img src="images/homepage_a_focused_mind.jpg" alt="" title="" usemap="#FPMap0" />
</div>
4

1 回答 1

0

现在这不是银盘,而是一些值得深思的东西,您应该能够使用此技术解决您的问题:

http://jsbin.com/aqobuj/1/edit

a {
  display:block;
  border:solid;
}
div {
  border:solid;
  height:100px;
  display:none;
}
a.one:hover ~ div#one {
  display:block;
}
a.two:hover ~ div#two {
  display:block;
}
a.three:hover ~ div#three {
  display:block;
}

使用的技术:

  • 悬停CSS伪选择器
  • display:block/none (css的隐藏/显示)
  • 波浪号/兄弟选择器(在这种情况下,给我下一个具有 x 类的 div)
于 2013-07-12T21:09:06.407 回答