jssor 滑块同时滑动

jssor sliders swipe in the same time

我在同一页面上有两个 Jssor "nearby-image-partial-visible-slider",我希望它们同时 swipe/move。这可能吗?有人可以告诉我如何实现这一目标吗? 谢谢!

var jssor_slider1 = new $JssorSlider$(...;

//set $AutoPlay: false for the second slider
var options2 = {
    ...,
    $AutoPlay: false,
    ...
}

var jssor_slider2 = new $JssorSlider$("slider2_container", options2);

function OnPositionChange(position) {
    //let jssor_slider2 go to the same position as jssor_slider1
    jssor_slider2.$GoTo(position);
}

//listen $JssorSlider$.$EVT_POSITION_CHANGE on jssor_slider1
jssor_slider1.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnPositionChange);

使 slider1 与 slider2 一起滑动

var jssor_slider1 = new $JssorSlider$(...;
var jssor_slider2 = new $JssorSlider$(...;

function OnPositionChange(position) {
    //let jssor_slider1 go to the same position as jssor_slider2
    jssor_slider1.$GoTo(position);
}

//listen $JssorSlider$.$EVT_POSITION_CHANGE on jssor_slider2
jssor_slider2.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnPositionChange);

编辑:

var jssor_slider1 = new $JssorSlider$(...;
var jssor_slider2 = new $JssorSlider$(...;

function OnPositionChange(position) {
    jssor_slider1.$GoTo(position);
    jssor_slider2.$GoTo(position);
}

jssor_slider1.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnPositionChange);
jssor_slider2.$On($JssorSlider$.$EVT_POSITION_CHANGE, OnPositionChange);