私はこれに数時間取り組んできましたが、他に何をすべきかよくわかりません。画面上で回転させたい画像が5つあります。テキストを下にクリックすると、画像が正しい位置に移動します。ただし、もう一度クリックすると、画像がランダムな方向に飛び出します。私の質問は、私のコードの何が問題なのかということです。それとももっと良いことに、私はそれをすべて間違っていますか?私には見えない、これを行う簡単な方法はありますか?実用的なjsfiddleの例を作成しましたhttp://jsfiddle.net/2uPJP/13/
関連するjsコード...
function convert () {
var $hide1 = $(".hide1");
var $hide2 = $(".hide2");
var $hide3 = $(".hide3");
var $hide4 = $(".hide4");
var $hide5 = $(".hide5");
$hide1.removeClass().addClass("hide2");
$hide2.removeClass().addClass("hide3");
$hide3.removeClass().addClass("hide4");
$hide4.removeClass().addClass("hide5");
$hide5.removeClass().addClass("hide1");
}
$(document).ready(function() {
$('.hide1').animate({
top: '+=100',
right: '+=100'
}, 1500);
$('.hide5').animate({
bottom: '+=100',
right: '+=100'
}, 1500);
$('.down').click(function() {
$('.hide1').animate({
left: '+=100'
}, 1500);
$('.hide2').animate({
top: '+=100'
}, 1500);
$('.hide3').animate({
top: '+=100'
}, 1500);
$('.hide4').animate({
right: '+=100'
}, 1500);
$('.hide5').animate({
bottom: '+=200'
}, 1500);
setTimeout(convert, 1501);
});
});