2012-09-05 45 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