我在选项卡式界面的一个页面上有多个 jcarousel 实例。单击相关选项卡时,我需要能够滚动到每个轮播的第一项,但我不确定如何执行此操作。我查看了静态控件示例 ( http://sorgalla.com/projects/jcarousel/examples/static_controls.html ),但无法理解如何使它适用于多个轮播。
任何帮助将非常感激。我正在进行的工作在这里:http://www.brainsdesign.com/client/Lab/14512/style.html
非常感谢,
克里斯
最佳答案
你可以使用类似的东西:
jQuery('#myCarousel')
.jcarousel('scroll',position);
position 是您的 jcarousel 的开始位置或您想要到达的索引。
这是来自 jquery.jcarousel.js 源文件:
/**
* 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.pauseAuto();
this.animate(this.pos(i), a);
},
关于javascript - 滚动到 jcarousel 的第一项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4589893/