JCarousel 滚动方法并不总是触发
var carousel = jQuery('#mycarousel').data('jcarousel');
var index = carousel.size() + 1;
carousel.size(index);
var html = '<li> some html </li>';
carousel.add(index, html);
carousel.scroll(index, 1);
最后一个滚动方法会触发,但并非总是如此。这是 JCarousel 中的错误吗?
下面是JCarousel中scroll方法的代码:
/**
* 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 carousel = jQuery('#mycarousel').data('jcarousel');
var index = carousel.size() + 1;
carousel.size(index);
var html = '<li> some html </li>';
carousel.add(index, html);
carousel.scroll(index, 1);
The very last scroll method fires but not always. Is this a bug in JCarousel?
The following is the code for the scroll method in JCarousel:
/**
* 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);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
参数 2 是一个布尔值。您指定了一个整数:
所以也许这会更好:
Parameter 2 is a boolean. You've specified an integer:
So maybe this would work better:
请尝试这样的事情
希望这有帮助!
please try something like this
Hope this helps!