2012-05-18 18 views
2

當我在IE9中壓下鼠標時,圖像保持不變。我必須點擊頁面的其他部分才能恢復。 Firefox和Chrome工作正常(他們放回原始圖像)。有任何想法嗎?css活動不會在IE9中做鼠標釋放

它甚至在這裏工作,如果我使用IE9 http://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro

但如果我在我的桌面上創建一個HTML和IE9中打開它。

<html> 
<head> 
<style type="text/css"> 
    #button{background:url("http://www.webstuffshare.com/wp-content/uploads/2010/03/button3.jpg") no-repeat 0 0;display:block;width:201px;height:67px;} 
    #button:hover{background-position:0px -67px;} 
    #button:active{background-position:0px -134px;} 
    #button span{position:absolute;top:-99999999em;} 
</style>  
</head> 
<body> 
    <a id="button" href="#"><span>this is foo</span></a> 
</body> 
</html> 
+0

您必須點擊該對象才能刪除它的活動狀態。 – Quantastical

+0

我看到的行爲是,如果我在釋放鼠標時依然「超過」按鈕,但是在所有三種瀏覽器(IE9,FF12,Chrome)中,如果按下按住鼠標按鈕並移開該按鈕,它保持「按下」狀態。一旦我在提升後再次移動鼠標,Chrome就對其進行了糾正,在這種情況下,Firefox和IE9似乎需要再次點擊。 – ScottS

回答

1

你最好不要使用JS事件:active可以表現unintuitively(類似的問題; :active css selector not working for IE8 and IE9

一到bodge你想將行爲方式;

<a id="button" href="#" onclick="this.blur();" onmouseout="this.blur();"><span>this is foo</span></a> 
+0

這很好用。謝謝。 – wubbewubbewubbe