누군가 내 코드를 평가하고 올바른지 알려주십시오.jquery animation 반복, 구문이 잘못 되었습니까?
애니메이션을 하나씩 실행하고 5000 밀리 초 동안 일시 중지하고 높이를 모두 0으로 재설정 한 다음 애니메이션을 무기한 반복합니다.
function animateThis(){
$(".bars div:nth-child(1)").animate({'height':'49px'}, 2000, function() {
$(".bars div:nth-child(2)").animate({'height':'112px'}, 2000, function() {
$(".bars div:nth-child(3)").animate({'height':'174px'}, 2000, function() {
$(".bars div:nth-child(4)").animate({'height':'236px'}, 2000, function() {
$(".bars div:nth-child(5)").animate({'height':'298px'}, 2000, function() {
$('.bars div').delay(2000).css({"height" : "0"}), function() { animateThis()};
});
});
});
});
});
}
$(".bars").ready(function(){animateThis()});
예
내가 어제받은 일부 답변에서 다시 포맷을 http://execusite.com/fazio/files/careers-banner/test.html에서 볼 수 있지만 여전히 작동하지 않습니다와 나는 어떤 피드백을받지 못했습니다.
감사합니다.
코드와 예상되는 동작을 설명했습니다. 실제 행동이란 무엇입니까? –
@ 카를 링크에서 실제 행동을 볼 수 있습니다. 설명을하겠습니다. 각 높이 애니메이션이 연속적으로 실행됩니다. 그러나 높이를 0으로 변경하기 전의 지연 시간은 작동하지 않으며 전체 기능이 반복되지 않습니다. 따라서 다섯 번째 막대가 움직이면 즉시 모든 값을 0으로 되돌리고 중지합니다. –
@JJ 왜'$ (". bars"). ready()'를 사용합니까? –