是否有人知道如何在加载时阻止群集(或嵌套)幻灯片播放?我尝试在“var slider1Options”,“var slider20ptions”和“var slider3Options”中输入“$ AutoPlay:false”,但它不起作用。
参考:http://www.jssor.com/demos/slider-cluster.html
提前谢谢。
答案 0 :(得分:1)
请删除以下代码,
//slider cluster controller code begin
function SliderCluster(mainSlider, autoPlayInterval) {
var _Self = this;
var _NestedSliders = [];
var _NestedSliderCurrent;
var _CaptionInCounter = 0;
function OnChildSliderStateChange(currentIndex, progress, progressBegin, idleBegin, idleEnd, progressEnd) {
if (progress == idleBegin) {
if (!(++_CaptionInCounter % 4)) {
_NestedSliderCurrent && _NestedSliderCurrent.$Pause();
mainSlider.$Play(true);
}
}
}
function OnMainSliderStateChange(currentIndex, progress, progressBegin, idleBegin, idleEnd, progressEnd) {
_NestedSliderCurrent = _NestedSliders[currentIndex];
if (_NestedSliderCurrent) {
if (progress == idleBegin) {
mainSlider.$Pause();
_NestedSliderCurrent.$Play(true);
}
else if (progress == progressBegin) {
_CaptionInCounter = 0;
mainSlider.$Play(true);
}
}
}
function OnMainSliderSwipeStart(position, virtualPosition) {
_NestedSliderCurrent && _NestedSliderCurrent.$Pause();
mainSlider.$Pause();
}
function OnMainSliderPark(slideIndex, fromIndex) {
_CaptionInCounter = 0;
mainSlider.$Play();
}
_Self.$AddChildSlider = function (childSlider, slideIndex) {
_NestedSliders[slideIndex] = childSlider;
childSlider.$On($JssorSlider$.$EVT_STATE_CHANGE, OnChildSliderStateChange);
};
_Self.$Start = function () {
mainSlider.$On($JssorSlider$.$EVT_PARK, OnMainSliderPark);
mainSlider.$On($JssorSlider$.$EVT_STATE_CHANGE, OnMainSliderStateChange);
mainSlider.$On($JssorSlider$.$EVT_SWIPE_START, OnMainSliderSwipeStart);
mainSlider.$Play(true);
}
}
var sliderCluster = new SliderCluster(jssorSliderc);
sliderCluster.$AddChildSlider(jssorSlider1, 0);
sliderCluster.$AddChildSlider(jssorSlider2, 1);
sliderCluster.$AddChildSlider(jssorSlider3, 2);
sliderCluster.$Start();
//slider cluster controller code end