4
$('.ip_button').click(function(){
var buttonValue, slideTimes;
buttonValue = $(this).html();
slideTimes = parseInt(buttonValue) - 1;
for (var i = 0 ; i < slideTimes; i++) {
slider.gallery_next();
}
});
안녕하세요 저는 여러 번 -1 번 슬라이드의 가치를 결정하는 기능을 사용하여 슬라이더에 여러 이미지를 슬라이드하려고합니다. 불행히도, function은 버튼에 어떤 값이 있더라도 한 번만 수행합니다. 현재 버튼의 값은 다음과 같습니다.반복 함수 x 번 반복에 대한 루프
<button class="ip_button">5</button>
gallery_next() 함수 캡슐화와 같이 간다 :
this.gallery_next = function() {
if (galleryRotating) { return; }
galleryRotating = true;
var elem = $(galleryId + " > li").first();
$(galleryId).append(elem.clone());
$(galleryId).animate({"left" : -imgWidth}, 650, function() {
elem.remove();
galleryRotating = false;
$(galleryId).css({"left" : 0});
});
이를 확인하시기 바랍니다 : http://jsfiddle.net/inser/LwhhD/3/ – inser
실제로 큐에 넣어 : 당신이 한 질문에 http://api.jquery.com/animate/ 애니메이션 효과가 이미 활성화되어 있는지 확인하여 애니메이션이 대기열에 들어 가지 않았는지 확인합니다. jsfiddle 샘플에서는 체크하지 않으므로 애니메이션이 대기합니다. – Aneri