我有2个元素,2个尺寸完全相同的图像,一个位于另一个之上。说他们被称为A和B(A是最高的)。我所做的就是当你把鼠标悬停在A上时,它的z-index减少2,所以B现在在最上面,而B的悬停:它的z-索引增加2,现在比A的原始值增加1 z-index(因此图像B保持最佳状态,直到您移除鼠标)。所以基本上...z-index和Internet Explorer 9
#A {z-index: 5;}
#B {z-index: 4;}
#A:hover {z-index: 3;}
#B:hover {z-index: 6;}
这工作完全在Firefox和Chrome,但IE不希望听到它,我的图片,同时不断盘旋在他们spazzing。任何帮助表示赞赏。定位是绝对的,如果这很重要。
@ jklm313
这实际上在我的IE9工程,以及。也许我应该发布完整的代码,因为我的一个“图片”实际上是一个社交网络按钮。所以在这里,它是:
HTML:
<div id="myTweetBrown"></div>
<div id="myTweet"><?php include ("myPHP/homepageSoc/tweet.php") ?></div>
CSS:
#myTweetBrown {
position: absolute;
background-image: url('../images/tweetBrown.png');
background-repeat: no-repeat;
background-position: center center;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 5;
}
#myTweetBrown:hover {
position: absolute;
z-index: 3;
}
#myTweet {
position: absolute;
height: 20px;
width: 54px;
left: 381px;
top: 662px;
z-index: 4;
}
#myTweet:hover {
position: absolute;
z-index: 6;
}
tweet.php:
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://localhost/Joomla173/index.php?option=com_content&view=article&id=69&Itemid=507" data-count="none">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
链接到演示网址:* ** * * - 向下滚动到Tweet按钮 这将只会持续很长时间,因为我不希望人们有这样的访问<。 <
听起来很像http://jhop.me/tests/bugs/ie8/dynamicstackingcontext.html - http://jhop.me/ie8-bugs第56号。 – 2012-01-28 01:43:10