我有这样的脚本:在jQuery的1.9我的图像互换不工作
jQuery(document).ready(function(){
$(".imgSwap").mouseenter(function() {
$(this).src("_off").replaceWith("_on");
}).mouseleave(function() {
$(this).src("_on").replaceWith("_off");
});
});
而且这个网站:
<div id="nav">
<table>
<tr>
<td class="tdleft">
<img src="../../nav/prev_off.png" width="104" height="37" /></td>
<td class="tdcenter">
<img src="../../nav/crumb_on.png" width="30" height="30" alt="Pagina 1" />
<img src="../../nav/crumb_off.png" width="30" height="30" />
<img src="../../nav/crumb_off.png" width="30" height="30" /></td>
<td class="tdright">
<a href="p02.html"><img class="imgSwap" src="../../nav/next_off.png" width="104" height="37" /></a></td>
</tr>
</table>
</div>
我无法说服我带班imgSwap图像交换上的mouseenter或鼠标离开。 我觉得问题出在代码replaceWith-part。 但我不知道如何解决它,并且我无法找到一个清晰的例子(至少在我看来)在Stack Overflow上。
图像置换等,这是一个有点讨厌,你要考虑的精灵或使用显示和隐藏。 – Blowsie 2013-05-01 14:07:19