$('.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并运行相应次数的滑块。不幸的是,无论按钮中的值是什么,该函数只执行一次。目前按钮中的值为:
<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});
});