您好我有這一塊HTML的父母懸停改變部分...jQuery的:兒童形象的href源
<a href="alcohol_calculator.php" class="swfselector">
» Alcohol unit calculator prototype
<img class="tab" src="/images/1.png" width="30" height="28" alt="1" />
<img class="tab" src="/images/2.png" width="30" height="28" alt="2" />
<img class="tab" src="/images/3.png" width="30" height="28" alt="3" />
<img class="tab" src="/images/5.png" width="30" height="28" alt="5" />
</a>
<a href="bouncing_ball.php" class="swfselector">
» Bouncing ball animation
<img class="tab" src="/images/3.png" width="30" height="28" alt="3" />
</a>
使用jQuery,我希望它這樣,當有人懸停在一個「swfselector」類所有帶有類別選項卡的子圖像將「o」添加到其src ...例如(/images/2o.png或/images/3.png/)中。
我有這個到目前爲止,但它什麼都沒做,並且會在「.png」之後添加「o」。
$('.swfselector').each.hover(function(){
$(this).find('.tab').attr('src'+'o');
});
幫助感謝。
謝謝這個工作,但我會有很多這些在頁面上的swf選擇器(超過一百)......這意味着一個巨大的CSS和JS文件。我也會一直將done2更改爲if語句中的最後一個事件變量嗎?我現在感覺更近了。 – 2011-04-21 11:13:25
是的,你必須改變做最新的號碼。就像done1,done2 ...等等。我正在以另一種方式工作。 – ryryan 2011-04-21 11:17:55
剛剛意識到不需要在swf選擇器的末尾添加數字,因爲它隻影響您懸停的那個數字。你知道我會如何反轉這個懸停,以便它可以再次運行,如果你懸停在不同的? – 2011-04-21 11:19:30