我有3 <a>
標籤在我的HTML和他們每個包含2個圖像。只顯示高分辨率圖像,其他圖像設置爲無。隱藏/取消隱藏圖像使用jQuery的懸停
我想隱藏灰度圖像,當我將鼠標懸停在grescale圖像上並顯示彩色圖像時。而當我懸停時,我想要彩色圖像再次隱藏。我如何使用jQuery來做到這一點?
<a class="mylink" href="">
<img src="img/thumbnails/colored-1.jpg" class="color-image"/>
<img src="img/thumbnails/greyscale-1.jpg" class="greyscale-image"/>
</a>
<a class="mylink" href="">
<img src="img/thumbnails/colored-2.jpg" class="color-image"/>
<img src="img/thumbnails/greyscale-2.jpg" class="greyscale-image"/>
</a>
<a class="mylink" href="">
<img src="img/thumbnails/colored-3.jpg" class="color-image"/>
<img src="img/thumbnails/greyscale-3.jpg" class="greyscale-image"/>
</a>
.color-image
{
display:none
}
爲最高upvoted回答說,你並不需要基於jQuery懸停控制CSS – Damian 2014-09-10 17:22:37