您好我有这一块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