2012-09-05 47 views
0

我将如何去动画以下JavaScript代码?我需要动画这个jquery

$('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 /鼠标离开

感谢您的帮助。

路易

回答

0

看来你是错这样做,相反,你可以有两个元素和隐藏,并相应地向他们展示和$ .toggle()方法本身自带的动画属性。

+0

感谢您的回复,我不知道如何做到这一点与我的代码,我新手与jQuery – user1468225