Getting Index of Current Item in JCarousel

前端 未结 11 1715
夕颜
夕颜 2021-02-05 20:25

I am attempting to get the index of the current item in a JCarousel so that I can display the current position within the Carousel to the user. For example, \'13/20\'.

H

11条回答
  •  情话喂你
    2021-02-05 20:44

    Depends of what you want to do but here is a more "generic way" to do the same, instead that you return the object itself and not is id:

    var currSlide = 0;
        function getCurrentCarouselItem(){
          $("ul#ulcol li.licol").each(function(){
            if ($(this).offset().left >= 0){
                currSlide = this;
                return false;
            }
          });
        return currSlide;
        }
    

提交回复
热议问题