问题描述
我正在使用滑块基本Jquery滑块
我想从第二个索引开始,有时要从第三个索引开始.
I want to start with 2nd index or sometimes 3rd index.
我该如何实现?我尝试了以下选项,但没有用:
How can I achieve this?I tried options below, but did not work:
$('#banner-slides').bjqs({
animtype : 'slide',
currentslide : 2,
currentindex : 1
});
推荐答案
this.goto = function(position){ // this keyword is added here
state.animating = false;
if(settings.animtype === "slide")
position = position + 1;
go(false,position);
}
init();
return this; // newly added code
您可以将上面的脚本添加到bjqs-1.3.js文件中,并像这样初始化滑块
You can add the above script to the bjqs-1.3.js file and initialize the slider like
var bannerslides = $('#banner-slides').bjqs({
animtype : 'slide'
});
然后使用bannerslides.goto(1)
转到第一张幻灯片
then use bannerslides.goto(1)
to go to first slide
您可以创建多个滑块
var bannerslides1 = $('#banner-slides1').bjqs({
animtype : 'slide'
});
var bannerslides2 = $('#banner-slides2').bjqs({
animtype : 'slide'
});
并像bannerslides1.goto(1)
一样使用它来转到bannerslides1
滑块的第一张幻灯片,而bannerslides2.goto(1)
来去bannerslides2
滑块的第一张幻灯片
and use it like bannerslides1.goto(1)
to go to first slide of bannerslides1
slider and bannerslides2.goto(1)
to go to first slide of bannerslides2
slider
我希望您可以计算出幻灯片编号
I hope you can calculate the slidenumbers
注意:我还没有完全测试.
NOTE : I haven't tested fully.
更新
如果动画是fade
更新
找到新代码,让我知道它是否有效
Find the new code and let me know if it works
这篇关于如何从特定索引开始-基本的jQuery滑块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!