我有一個圖像列表,當DOM被加載時,這些圖像都被設置爲40%不透明度。JQuery元素不透明度設置
我需要這些圖像中的第一個保持100%的不透明度,因爲其他的圖像會消失。
我的代碼如下,但我似乎無法讓第一個圖像保持在100%。
$j(document).ready(function() {
fadeDownImages();
fadeDownImages = function() {
$j("ul.promo img").fadeTo(1500, 0.2);
$j("ul.promo img").hover(function(){
$j(this).fadeTo(300, 1.0); // This should set the opacity to 100% on hover
},function(){
$j(this).fadeTo(200, 0.2); // This should set the opacity back to 60% on mouseout
});
};
$j("ul.promo img:first-child").fadeIn(200, 1.0);
任何幫助非常讚賞
感謝您的幫助 @cpharmston - 這似乎並沒有爲所有圖像的工作,現在留100%。我沒有得到任何錯誤。如果我刪除:not(:first-child),它允許圖像淡入淡出。 @chaos - 這也沒有工作...什麼是:GT(1)做的? 謝謝 – Martin 2009-07-29 12:25:46