이 사전 애니메이션을 받았으며 2 초 후에 경고가 나타납니다. 이것은 작동합니다 :
$('.tableContent').find('.turnEditPanel').animate({'height': 36}, 300).delay(1000).queue(function() {
alert("HI");
});
이제 다른 애니메이션으로 경고를 변경하여 애니메이션을 되돌리기 위해 동일한 div에 영향을 주면 아무 일도 일어나지 않으므로 해당 또는 s.thing을 식별하지 못하는 것 같습니다 .. :
$('.tableContent').find('.turnEditPanel').animate({'height': 36}, 300).delay(1000).queue(function() {
$('.tableContent').find('.turnEditPanel').animate({'height': 0}, 300);
});
이것은 (this)와 함께 작동하지 않습니다.
$('.tableContent').find('.turnEditPanel').animate({'height': 36}, 300).delay(1000).queue(function() {
$(this).animate({'height': 0}, 300);
});
왜을 사용하는지 모르겠지만 .queue
이벤트를 연결하거나 complete
첫 번째 호출 에서 콜백을 .animate()
대신 사용해야합니다 .
연결을 사용한 예 :
$('.tableContent').find('.turnEditPanel').animate({'height': 36}, 300).delay(1000).animate({'height': 0}, 300);
전체 콜백을 사용하는 예 :
$('.tableContent').find('.turnEditPanel').animate({'height': 36}, 300, function() {
$(this).delay(1000).animate({'height': 0}, 300);
});
최신 정보
A. Wolff가 그의 의견에서 언급했듯이, alert('HI')
작업을 수행 queue()
하지만 animate()
대기열 콜백 내에서 animate를 호출하면 애니메이션 대기열에 넣지 만 대기열의 다음 항목을 호출 할 때까지 실행되지 않습니다. 예를 들면 다음과 같습니다.
.queue(function(next) {
$(this).animate({'height': 0}, 300);
next();
});
//next is shorthand for dequeue('fx'). "fx" is name of the default queue created by jQuery.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다