jssor / slider

Touch swipe image slider/slideshow/gallery/carousel/banner mobile responsive bootstrap

Home Page:https://www.jssor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$CurrentIndex() issue on first load

giuliac1989 opened this issue · comments

Hi,

I need to get the current slide index, but on first load it return -1.
Below my code:

$(document).ready(function () {
   var galleryOptions = {
          $Loop: 1,
          $DragOrientation: 0,
          $SlideDuration: 500,
          $ArrowNavigatorOptions: {
               $Class: $JssorArrowNavigator$,
               $ChanceToShow: 2,
               $Steps: 1
           },
          $ThumbnailNavigatorOptions: {
               $Class: $JssorThumbnailNavigator$,
               $ChanceToShow: 2,
               $ActionMode: 1,
               $SpacingX: 5,
               $Cols: 6,
               $Align: 0
         }
   };
});

var gallery = new $JssorSlider$('gallery', galleryOptions);

var currentSlideIndex = gallery.$CurrentIndex(); // return -1

I can't figure out why. Do you have any idea?

Thanks!

commented

I think you can get the $CurrentIndex after a few mini seconds.

commented

The issue has been fixed.