2011-05-09 75 views
1

嘿傢伙, 我沒有運氣做一個簡單的背景圖像動畫工作沒有protofunc()的背景位置插件。jquery:無插件動畫背景位置?

我之前使用過插件,一切正常。但是,自從1.6版本的jQuery插件被破壞,不再工作。

有沒有機會讓我無法使用此插件輕鬆實現backgroundPosition動畫?

這是我使用的代碼:

//Comment form 
$("#comment").focus(function() { 
    $(this).css({"background-color":"#fff"}); 
    $(this).animate({backgroundPosition: '220% 16px'}, { 
     duration: 500, 
     easing: 'easeOutQuint', 
     complete: function() { } 
    }); 

}); 
+0

不建議在相同位置屬性中混合使用%和px。無論如何,你將不得不發佈更多的代碼,我不確定你的$(this)是否引用了正確的對象,不確定是否在你的頁面中加載了jquery UI,以便引用easing插件,太多未知數,所以更多的代碼plz。 – forthehackofit 2011-05-09 07:13:28

+0

更新了我的問題... #comment是一個應用了背景圖像的textarea。當聚焦textarea時,圖像應該向右移動。 – matt 2011-05-09 07:41:12

回答

-1

要麼恢復到的jQuery以前版本的工作,或者設置一個實際<img>爲背景和動畫效果。