在一個網站,我想撼動一個包含圖像的div,它固定在頁面的底部。我嘗試給它添加搖動功能,它正在晃動,但是位置變爲左側。我該如何解決它?讓我寫代碼。jQuery Shake破解位置:固定
var css_shake={
right: '225px',
left: 'auto',
position: 'fixed',
bottom:'50px'
}
jQuery.fn.shake = function() {
this.each(function(i) {
jQuery(this).css(css_shake);
for (var x = 1; x <= 3; x++) {
jQuery(this).animate({ left: -25 }, 10).animate({ left: 0 }, 50).animate({ left: 25 }, 10).animate({ left: 0 }, 50);
}
});
return this;
}
當寫$(div).shake()它的作品,但不是我想要做的。
<div id="affix_sepet">
<img src="img/sepet_yeni.png" height="226" width="163">
</div>
這個div也有引導詞綴:jQuery的( 「#affix_sepet」)加蓋()
你可以發佈的HTML以及? – jbkkd