简体   繁体   English

在Jssor滑块中选择个性化幻灯片

[英]Choosing personalization slide in Jssor slider

First I have a slider with 3 images that rotate up and have a selector. 首先,我有一个带有3个向上旋转的图像并带有选择器的滑块。

 var jssor_slider1 = new $JssorSlider$("slider1_container", options);

I have a function in which, depending on the selected option in the select, I want to stop and show a specific slide the slider. 我具有一项功能,其中要根据选择中的所选选项,停止并显示特定的滑块滑块。

How could he? 他怎么会

This is the function that I have but does not work well. 这是我所拥有的功能,但是无法正常工作。

$(".enlace").click(function(i){

    var id = $(this).attr("id");

    if(id == 'SDINERO'){

          options = {
            $AutoPlay: false,
            $StartIndex : 0,
            $PauseOnHover : 3
            };

         var jssor_slider2 = new $JssorSlider$("slider1_container", options);

    }
    else{

        options = {
            $AutoPlay: false,
            $StartIndex : 1,
            $PauseOnHover : 3
            };

         var jssor_slider3 = new $JssorSlider$("slider1_container", options);
     }  

    if(contador==0){

      var text = $(this).text();

      $('#tit').text(text);
      $("#proyecto").val(id);
      $("#proyecto").change();
      $(".enlace").slideUp('fast');
      $('#opaco').css('display','none');
      $('.main').css('display','block');
      $('#simulador-container').css('height','450px');
      $("#simulador-container").slideDown('fast');
      $('#slider1_container').css('height','495px');
      $("#slider1_container").slideDown('fast');

      contador = 1;
    }
    else{
      var id = $(this).attr("id");

      var text = $(this).text();

      $('#tit').text(text);
      $("#proyecto").val(id);
      $("#proyecto").change();
      $(".enlace").slideUp('fast'); 
    }

}); });

Thank you. 谢谢。

You can do that job in following manner, 您可以按照以下方式完成这项工作,

var options = {
    ...
    $AutoPlay: false,
    ...
};

var jssor_slider1 = new $JssorSlider$("slider1_container", options);

function OptionSelectedHandler(optionValue)
{
    var slideIndex = 2;
    if(optionValue == "SDINERO"){
        slideIndex = 0;
    }
    jssor_slider1.$PlayTo(slideIndex);

    //optionally you can use following line to switch the slider to specified slide directly.
    //jssor_slider1.$GoTo(index);
}

//your code here to
//do something to capture the 'select' event and then call OptionSelectedHandler

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM