jssor多个实例 - 在第一个jssor实例的$ EVT_POSITION_CHANGE事件上更改第二个jssor实例的幻灯片

时间:2014-10-19 15:39:31

标签: jssor

当第一个jssor滑块上的幻灯片放映位置更改事件触发器时,任何人/ jssor支持可以帮助我如何更改第二和第三个jssor滑块的图像吗?我将非常感激。

感谢, ç

这个jssor_slider2。$ GoTo(1);没有用。

++++++++++++++++++++++++++++++

function OnSlidePositionChange(slideIndex, fromIndex) {
    var jssor_slider2 = new $JssorSlider$('slider2_container', { $AutoPlay: false });
    if (slideIndex == 3)
        jssor_slider2.$GoTo(1);
    else 
        jssor_slider2.$GoTo(slideIndex + 1);
}
jssor_slider1.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnSlidePositionChange);

++++++++++++++++++++++++++++++

<script>
jssor_slider1_starter("slider1_container");

jssor_slider2_starter("slider2_container");

jssor_slider3_starter("slider3_container");
</script>

script.js file

jssor_slider1_starter = function (containerId) {
    var jssor_slider1 = new $JssorSlider$(containerId, {
...
}

function OnSlidePositionChange(slideIndex, fromIndex) {

//HELP ME PLEASE HERE.....

        //var jssor_slider2 = new $JssorSlider$('slider2_container', {});
        //if (slideIndex == 3)
        //    nestedSliders[1].$GoTo(1);
        //else 
        //    nestedSliders[1].$GoTo(slideIndex + 1);
    }
    jssor_slider1.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnSlidePositionChange);


}


jssor_slider2_starter = function (containerId) {
    var jssor_slider2 = new $JssorSlider$(containerId, {
......
}
}

jssor_slider3_starter = function (containerId) {
    var jssor_slider3 = new $JssorSlider$(containerId, {
......
}
}

1 个答案:

答案 0 :(得分:0)

$ JssorSlider $。$ EVT_POSITION_CHANGE在滑动时连续发射。 $ JssorSlider $。$ EVT_PARK会在幻灯片更改时触发。

请以这种方式完成这项工作,

function jssor_slider3_starter(containerId_1, containerId_2, containerId_3)
{
    var options1 = {};
    var options2 = {};
    var options3 = {};
    ...
    var jssor_slider1 = new $JssorSlider$(containerId_1, options1);
    var jssor_slider2 = new $JssorSlider$(containerId_2, options2);
    var jssor_slider3 = new $JssorSlider$(containerId_3, options3);
    ...

    function OnSlidePark(slideIndex, fromIndex) {
        if (slideIndex == 3)
            jssor_slider2.$GoTo(1);
        else 
            jssor_slider2.$GoTo(slideIndex + 1);
    }
    jssor_slider1.$On($JssorSlider$.$EVT_PARK, OnSlidePark);
    ...
}