我有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