Image Mouseover淡入/淡出JQUERY ONLY,响应

时间:2013-11-21 21:12:11

标签: jquery html hover mouseover fade

我已经搜索了超过6个小时,但没有找到我正在寻找的东西。我有你典型的鼠标悬停。一个图像,你将鼠标悬停在它上面,它会变为另一个图像,取消悬停并返回到它的图像。我想要的确如此,但是它已经消失了。我认为这很简单,但显然不是。我不想要CSS。它没有响应。我的图像根据屏幕大小改变大小(我使用的是基础4)。我有完美的代码(响应),但没有褪色。如果我可以让别人告诉我如何为我的代码添加淡入淡出,这很好,因为坦率地说:我不知道怎么做。这是我的代码:

<script language="JavaScript" type="text/javascript">

if (document.images) {
    productbuttonup = new Image();
    productbuttonup.src = "http://placehold.it/100x100";
    productbuttondown = new Image();
    productbuttondown.src = "http://placehold.it/100x100/eeeeee";

    aboutbuttonup = new Image();
    aboutbuttonup.src = "http://placehold.it/100x100/333333";
    aboutbuttondown = new Image();
    aboutbuttondown.src = "http://placehold.it/100x100/777777";
}

function buttondown(buttonname) {
    if (document.images) {
        document[buttonname].src = eval(buttonname + "down.src");
    }
}

function buttonup(buttonname) {
    if (document.images) {
        document[buttonname].src = eval(buttonname + "up.src");
    }
}

</script>

当然是html:

<div class="large-3 columns image"><a href="about.html"
onmouseover="buttondown('productbutton')"
onmouseout="buttonup('productbutton')"><img src="img/product_photography.jpg"   name="productbutton" class="productbutton"></a></div>

http://jsfiddle.net/k7Cfs/

0 个答案:

没有答案