Javascript JCarousel滚动方法并不总是激发

Javascript JCarousel滚动方法并不总是激发,javascript,jcarousel,carousel,Javascript,Jcarousel,Carousel,@param一个{Boolean}标志,指示是否执行动画。 参数2是一个布尔值。您指定了一个整数: carousel.scroll(索引,1) 因此,也许这会更好: carousel.scroll(索引,true) 请尝尝这样的 /** * Scrolls the carousel to a certain position. * * @method scroll * @return undefined * @param i {Number} The index of the elem

@param一个{Boolean}标志,指示是否执行动画。

参数2是一个布尔值。您指定了一个整数:

carousel.scroll(索引,1)

因此,也许这会更好:

carousel.scroll(索引,true)


请尝尝这样的

/**
 * Scrolls the carousel to a certain position.
 *
 * @method scroll
 * @return undefined
 * @param i {Number} The index of the element to scoll to.
 * @param a {Boolean} Flag indicating whether to perform animation.
 */
scroll: function(i, a) {
    if (this.locked || this.animating)
        return;
    this.animate(this.pos(i), a);
}
希望这有帮助

/**
 * Scrolls the carousel to a certain position.
 *
 * @method scroll
 * @return undefined
 * @param i {Number} The index of the element to scoll to.
 * @param a {Boolean} Flag indicating whether to perform animation.
 */
scroll: function(i, a) {
    if (this.locked || this.animating)
        return;
    this.animate(this.pos(i), a);
}
var position = 11; // assuming that every page contains 10 elements.
// now this will move your scroll to a desired position (first element to show)
jQuery('#myCarousel').jcarousel('scroll',position);