Fadein鼠标悬停和淡出鼠标
问题描述:
我一直在尝试使用所有不同的代码,但仍不能得到这个工作。我需要的只是在鼠标悬停时淡出图像,并在鼠标悬停时淡出。不交换图像。我只需要淡入淡出效果。Fadein鼠标悬停和淡出鼠标
在鼠标上淡入淡出就像一种魅力,但在鼠标上我的图像不会正常淡出。我只需要在退出鼠标时将图像恢复到原始状态。
当我将鼠标移回图像时,它有时会循环淡入和淡出效果。
请帮助=(
这里是我的代码:
<img src="images/adapter-vector.png" width="250" height="88" id="Image1" onmouseover="MM_effectAppearFade (this, 500, 100, 50, true)" Onmouseout="MM_effectAppearFade(this, 500, 50, 100, true)">
答
使用jQuery非常简单
$("#Image1").hover(
function() {
$(this).attr('src','image1.jpg');
}, function() {
$(this).attr('src','image2.jpg');
}
);
它不能去任何更简单...希望它可以帮助!
尝试'onmouseenter =“...”'和'onmouseleave =“...”'而不是mouseove r和moseout。 – theonlygusti 2014-09-21 19:12:48