나는 각각에 약간의 지연이있는 3 개의 li 항목 그룹이 각각 자체적으로 슬라이딩됩니다. 다음 버튼을 클릭해도 아무 일도 일어나지 않게하고 싶지만 3 개의 lis가 이미 애니메이션 중입니다.
// when next is clicked
$('.sh > .next').click(function() {
// slide in the individual lis
$('div.active li').eq(0).animate({
'left': 0,
'right': 'auto'
});
$('div.active li').eq(1).delay(600).animate({
'left': 100,
'right': 'auto'
});
$('div.active li').eq(2).delay(1200).animate({
'left': 200,
'right': 'auto'
});
});
true
애니메이션이 진행중인 경우 로 설정된 플래그를 추가합니다 .
var animating = false;
var animationTime = 1800; // Stores the duration of the animation
$('.sh > .next').click(function() {
if(!animating) {
animating = true;
$('div.active li').eq(0).animate({
'left': 0,
'right': 'auto'
});
$('div.active li').eq(1).delay(600).animate({
'left': 100,
'right': 'auto'
});
$('div.active li').eq(2).delay(1200).animate({
'left': 200,
'right': 'auto'
});
// Reset the flag, once the animation is complete.
// This can also be done in a callback of the last animate().
setTimeout(function() {
animating = false;
}, animationTime);
}
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다