【发布时间】:2013-10-20 23:49:28
【问题描述】:
$(function () {
$(".btn").on("mouseover",function(){
$(this).attr("src", $(this).attr("src").replace("images", "images/hover"));
});
$(".btn").on("mouseleave",function(){
$(this).attr("src", $(this).attr("src").replace("images/hover", "images"));
});
});
上面的代码是我在用户将鼠标悬停在按钮上时更改图像的方式,当用户单击它时,它将重定向到其他页面。而 Html 元素是这样的:
<a href="product.php"><img class="btn" src="images/index_03.gif" /></a>
问题是,我确定路径是正确的,但是当用户单击按钮时,在加载下一页期间或在某些情况下,当我将鼠标悬停在图像上时,悬停的图像未显示但是断开的链接,为什么会这样以及如何修复它?感谢您的帮助
【问题讨论】:
标签: javascript jquery html image hover