我需要设置这个jquery的动画

我需要设置这个jquery的动画,jquery,animation,onmouseover,Jquery,Animation,Onmouseover,我将如何制作以下javascript代码的动画 $('img').bind('mouseenter mouseleave', function () { $(this).attr({ src: $(this).attr('data-other-src'), 'data-other-src': $(this).attr('src'), 'style': $(this).attr('data-other-style'), 'data-other-style':

我将如何制作以下javascript代码的动画

$('img').bind('mouseenter mouseleave', function () {
    $(this).attr({
        src: $(this).attr('data-other-src'), 'data-other-src': $(this).attr('src'),
        'style': $(this).attr('data-other-style'), 'data-other-style': $(this).attr('style')
    });
});
它所做的是将一个图像切换到另一个图像并改变样式,我需要在mouseenter/mouseleave上使其淡入/淡出

谢谢你的帮助


Louis

看起来你做得不对,相反,你可以有两个元素,并相应地隐藏和显示它们,并且$.toggle()方法本身带有动画属性。

谢谢你的回复,我不知道如何使用我的代码,我是jquery的新手