Getting Index of Current Item in JCarousel

前端 未结 11 1838
夕颜
夕颜 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:53

    I think what you are looking for is carousel.first, which will give you the index of the first visible element (there is also carousel.last to show the last visible element).

    Here is an example of it's use, based on the simple carousel example with the addition of the carousel.first variable and itemLoadCallback event:

    
    
    
    
    

    jCarousel

    Riding carousels with jQuery

    Simple carousel

    This is the most simple usage of the carousel with no configuration options.

    Current Photo 1

提交回复
热议问题