這完全.js文件在fiddle爲什麼jquery動畫不像它應該旋轉的那樣旋轉?
function animationLoop() {
$("#ToBeAnimated").css({
top: ($("#paperTrail").offset().top - parseInt($("#ToBeAnimated").height())/2),
left: ($("#paperTrail").offset().left - parseInt($("#ToBeAnimated").width())/2)
}).rotate(270);
$("#ToBeAnimated").animate({
top: $("#paperTrail").offset().top + $("#paperTrail").height() - $("#ToBeAnimated").height()/2
}, 1000, function() {
$(this).animate({
rotate: "180deg"
}, function() {
$("#ToBeAnimated").animate({
left: $("#paperTrail").offset().left + $("#paperTrail").width() - $("#ToBeAnimated").width()/2
}, 1000, function() {
$(this).animate({
rotate: "90deg"
}, function() {
$("#ToBeAnimated").animate({
top: $("#paperTrail").offset().top - $("#ToBeAnimated").height()/2
}, 1000, function() {
$(this).animate({
rotate: "0deg"
}, function() {
$("#ToBeAnimated").animate({
left: $("#ToBeAnimated").width()/2
}, 1000, function() {
setTimeout(animationLoop, 1000);
});
});
});
});
});
});
});
}
animationLoop();
作品但在剪刀旋轉不工作或以某種方式打破了實際的網站...我已經檢查它...猜測和檢查研究...可能的衝突......但我堅持!也許我錯過了一些明顯的東西?
感謝百萬人的幫助!...要在活動網站上看到動畫,只需點擊「Clip It !!!」第一張優惠券底部的按鈕!
UPDATE:這是與具有網頁動畫的多個實例......當我看到with one result它爲我的網頁... ...但是...我仍然無法使其與網頁上的許多項目一起工作(這就是我真正追求的目標)....理想情況下...無論您點擊哪張優惠券,都會在其上顯示動畫...目前,該動畫僅適用於第1天優惠券...和非常shakey
再次感謝!
[fiddle](http://jsfiddle.net/djb3T/1/) – DigitalMediaGuy
我得到一個引用錯誤:'ReferenceError:clipIt2未定義'。請注意,在修復範圍問題後,ID必須是唯一的,請考慮使用類而不是ID。實際上動畫只會在具有該特定ID的第一個元素上執行。 – undefined
使用了太多的$(「#ToBeAnimated」)和$(「#paperTrail」)。我建議你爲此創建一個變量並隨處使用。這會讓它更快一點。 –