2013-06-22 29 views
0

我試圖在表格單元格中獲取圖像以將鼠標懸停在表格單元格上時應用它。我不確定是否有辦法通過CSS來實現。將Webkit篩選器應用於懸停在單元格上的表格單元格中的圖像

[編輯]

table.flip td:hover { 
    background-color: #510000; 
    cursor: pointer; 
    -webkit-transition: all .5s ease-in-out; 
    -moz-transition: all .5s ease-in-out; 
    -o-transition: all .5s ease-in-out; 
    transition: all .5s ease-in-out;} 

table.flip td:hover img { 
    -webkit-filter: brightness(400%); 
    -webkit-transition: all .5s ease-in-out; 
    -moz-transition: all .5s ease-in-out; 
    -o-transition: all .5s ease-in-out; 
    transition: all .5s ease-in-out;} 

以上是工作,現在比的事實,鼠標放在了不重新申請過渡效果等。陷入困境已經漸漸消失,但是它已經回到了原來的狀態。上面的代碼適用於我在網站上應用此過濾器的所有其他圖像(根據過渡和過渡)。

是因爲它是一張桌子嗎?該表格也在一個框架內,但其他過濾的圖像也是如此。不知道爲什麼它不會轉回。

+0

table.flip TD:懸停IMG {} ...因爲你已經提到的自己......是這樣做......還是我誤解你的問題? – conceptdeluxe

+0

呃,woops,意思是說沒有用。我會再試一次,以確保我不會把它搞亂。 –

+0

嗯,它現在可以工作,但是當我取消單元格時,「輕鬆」不起作用。它只是眨眼回到原來的狀態。 「緩解」工作正常。不知道爲什麼會發生這種情況。 –

回答

0

關於你的過渡問題 - 看看:

http://learn.shayhowe.com/advanced-html-css/transitions-animations

的色彩過渡工作就像一個魅力。

編輯:

好了,現在我看到你的問題:

過渡需要蜜蜂應用於元素本身而不是懸停狀態。

table.flip td { 
    cursor: pointer; 
    -webkit-transition: all .5s ease-in-out; 
    -moz-transition: all .5s ease-in-out; 
    -o-transition: all .5s ease-in-out; 
    transition: all .5s ease-in-out; 
} 

table.flip td:hover { 
    background-color: #510000; 
} 

table.flip td img { 
    -webkit-transition: all .5s ease-in-out; 
    -moz-transition: all .5s ease-in-out; 
    -o-transition: all .5s ease-in-out; 
    transition: all .5s ease-in-out; 
} 

table.flip td:hover img { 
    -webkit-filter: brightness(400%); 
} 

這裏是小提琴:

http://jsfiddle.net/ULHb4/

+0

以上只適用於背景顏色,但我正在使用圖像 –

+0

啊,快照。我曾嘗試過,但沒有使用正確的標籤。非常感謝你,修正了它。 –

+0

不客氣!所以請讓我的回答接受答案:) – conceptdeluxe

相關問題