title: jssor slider - many sliders on one page
body: <p>I saw many posts for placing multiple instances of the jssor slider on a page. However, I want to dynamically add multiple sliders, depending on PHP queries and the content in my CMS. So, the page has to be ready to handle 2 or 20 sliders ... or more.</p>
  
  <p>There are many posts on stackoverflow that show how I can add two sliders as follows...</p>
  
  <pre><code>var jssor_slider1 = new $JssorSlider$("slider1_container", options);
  var jssor_slider2 = new $JssorSlider$("slider2_container", options);
  </code></pre>
  
  <p>... and then refer to each ID (i.e. slider2_container) when I refer to the slider. But what if I have 20 sliders (or more), I don't want to have to have 20 different lines for the sliders (or worry about MORE if there are MORE than 20).  I would prefer to have something for a general slider... I don't write javascript, but something like (I know this is wrong, but the * below refers to any #) ...</p>
  
  <pre><code>var jssor_slider* = new $JssorSlider$("slider*_container", options);
  </code></pre>
  
  <p>I saw this post...
  <a href="https://stackoverflow.com/questions/30062537/jssor-non-jquery-slider-dynamic-amount-multiple-slider-on-one-page">Jssor non-jquery slider dynamic amount multiple slider on one page</a>
  ... but it is left unanswered. I will populate the page and the slider with information from my CMS (which I am customizing with galleries).</p>
  
  <p>And, as I mentioned, I've seen many other posts for 2 or 3 sliders ... but nothing to handle an unknown number.  Please let me know.</p>
  
  <pre><code>&lt;script type="text/javascript" src="/js/jquery-1.9.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/js/jssor.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/js/jssor.slider.js"&gt;&lt;/script&gt;
  &lt;script&gt;
          jQuery(document).ready(function ($) {
  
              var _CaptionTransitions = [];
              _CaptionTransitions["L"] = { $Duration: 900, x: 0.6, $Easing: { $Left: $JssorEasing$.$EaseInOutSine }, $Opacity: 2 };
              _CaptionTransitions["R"] = { $Duration: 900, x: -0.6, $Easing: { $Left: $JssorEasing$.$EaseInOutSine }, $Opacity: 2 };
              _CaptionTransitions["T"] = { $Duration: 900, y: 0.6, $Easing: { $Top: $JssorEasing$.$EaseInOutSine }, $Opacity: 2 };
              _CaptionTransitions["B"] = { $Duration: 900, y: -0.6, $Easing: { $Top: $JssorEasing$.$EaseInOutSine }, $Opacity: 2 };
              _CaptionTransitions["ZMF|10"] = { $Duration: 900, $Zoom: 11, $Easing: { $Zoom: $JssorEasing$.$EaseOutQuad, $Opacity: $JssorEasing$.$EaseLinear }, $Opacity: 2 };
              _CaptionTransitions["RTT|10"] = { $Duration: 900, $Zoom: 11, $Rotate: 1, $Easing: { $Zoom: $JssorEasing$.$EaseOutQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInExpo }, $Opacity: 2, $Round: { $Rotate: 0.8} };
              _CaptionTransitions["RTT|2"] = { $Duration: 900, $Zoom: 3, $Rotate: 1, $Easing: { $Zoom: $JssorEasing$.$EaseInQuad, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInQuad }, $Opacity: 2, $Round: { $Rotate: 0.5} };
              _CaptionTransitions["RTTL|BR"] = { $Duration: 900, x: -0.6, y: -0.6, $Zoom: 11, $Rotate: 1, $Easing: { $Left: $JssorEasing$.$EaseInCubic, $Top: $JssorEasing$.$EaseInCubic, $Zoom: $JssorEasing$.$EaseInCubic, $Opacity: $JssorEasing$.$EaseLinear, $Rotate: $JssorEasing$.$EaseInCubic }, $Opacity: 2, $Round: { $Rotate: 0.8} };
              _CaptionTransitions["CLIP|LR"] = { $Duration: 900, $Clip: 15, $Easing: { $Clip: $JssorEasing$.$EaseInOutCubic }, $Opacity: 2 };
              _CaptionTransitions["MCLIP|L"] = { $Duration: 900, $Clip: 1, $Move: true, $Easing: { $Clip: $JssorEasing$.$EaseInOutCubic} };
              _CaptionTransitions["MCLIP|R"] = { $Duration: 900, $Clip: 2, $Move: true, $Easing: { $Clip: $JssorEasing$.$EaseInOutCubic} };
  
              var options = {
                  $FillMode: 2, //[Opt] The way to fill image in slide, 0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actual size, 5 contain for large image, actual size for small image, default=0
                  $AutoPlay: true, //[Opt] Whether to auto play, this option must be set to true, default=false
                  $AutoPlayInterval: 4000, //[Opt] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default=3000
                  $PauseOnHover: 1, //[Opt] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, 4 freeze for desktop, 8 freeze for touch device, 12 freeze for desktop and touch device, default=1
  
                  $ArrowKeyNavigation: true, //[Opt] Allows keyboard (arrow key) navigation or not, default value is false
                  $SlideEasing: $JssorEasing$.$EaseOutQuint, //[Opt] Specifies easing for right to left animation, default value is $JssorEasing$.$EaseOutQuad
                  $SlideDuration: 1200, //[Opt] Duration (swipe) for slide in milliseconds, default value is 500
                  $MinDragOffsetToSlide: 20, //[Opt] Minimum drag offset to trigger slide , default value is 20
                  //$SlideWidth: 600, //[Opt] Width of every slide in pixels, default is width of 'slides' container
                  //$SlideHeight: 300, //[Opt] Height of every slide in pixels, default is height of 'slides' container
                  $SlideSpacing: 0, //[Opt] Space between each slide in pixels, default=0
                  $DisplayPieces: 1, //[Opt] Number of pieces to display (the slideshow would be disabled if the value is set to greater than 1), the default=1
                  $ParkingPosition: 0, //[Opt] The offset position to park slide (this options applys only when slideshow disabled), default=0.
                  $UISearchMode: 1, //[Opt] The way (0 parellel, 1 recursive, default value is 1) to search UI components (slides container, loading screen, navigator container, arrow navigator container, thumbnail navigator container etc).
                  $PlayOrientation: 1, //[Opt] Orientation to play slide (for auto play, navigation), 1 horizental, 2 vertical, 5 horizental reverse, 6 vertical reverse, default value is 1
                  $DragOrientation: 1, //[Opt] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
  
                  $CaptionSliderOptions: { //[Opt] Options which specifies how to animate caption
                      $Class: $JssorCaptionSlider$, //[Req] Class to create instance to animate caption
                      $CaptionTransitions: _CaptionTransitions, //[Req] An array of caption transitions to play caption, see caption transition section at jssor slideshow transition builder
                      $PlayInMode: 1, //[Opt] 0 None (no play), 1 Chain (goes after main slide), 3 Chain Flatten (goes after main slide and flatten all caption animations), default=1
                      $PlayOutMode: 3 //[Opt] 0 None (no play), 1 Chain (goes before main slide), 3 Chain Flatten (goes before main slide and flatten all caption animations), default=1
                  },
  
                  $BulletNavigatorOptions: { //[Opt] Options to specify and enable navigator or not
                      $Class: $JssorBulletNavigator$, //[Req] Class to create navigator instance
                      $ChanceToShow: 2, //[Req] 0 Never, 1 Mouse Over, 2 Always
                      $AutoCenter: 1, //[Opt] Auto center navigator, 0 None, 1 Horizontal, 2 Vertical, 3 Both, default=0
                      $Steps: 1, //[Opt] Steps to go for each nav request, default=1
                      $Lanes: 1, //[Opt] lanes to arrange items, default=1
                      $SpacingX: 8, //[Opt] Horizontal space between each item in pixel, default=0
                      $SpacingY: 8, //[Opt] Vertical space between each item in pixel, default=0
                      $Orientation: 1 //[Opt] Orientation of the nav, 1 horizontal, 2 vertical, default=1
                  },
  
                  $ArrowNavigatorOptions: { //[Opt] Options to specify and enable arrow navigator or not
                      $Class: $JssorArrowNavigator$, //[Requried] Class to create arrow navigator instance
                      $ChanceToShow: 1, //[Req] 0 Never, 1 Mouse Over, 2 Always
                      $AutoCenter: 2, //[Opt] Auto center, 0 No, 1 Horizontal, 2 Vertical, 3 Both, default=0
                      $Steps: 1 //[Opt] Steps to go for each navigation request, default=1
                  }
              };
  
              var jssor_slider1 = new $JssorSlider$("slider1_container", options);
  
              //responsive code begin
              //you can remove responsive code if you don't want the slider scales while window resizes
              function ScaleSlider() {
                  var bodyWidth = document.body.clientWidth;
                  if (bodyWidth)
                      jssor_slider1.$ScaleWidth(Math.min(bodyWidth, 1280));
                  else
                      window.setTimeout(ScaleSlider, 30);
              }
              ScaleSlider();
  
              $(window).bind("load", ScaleSlider);
              $(window).bind("resize", ScaleSlider);
              $(window).bind("orientationchange", ScaleSlider);
              //responsive code end
          });
      &lt;/script&gt;
  </code></pre>