Get Current Slide Index of jQuery Cycle 2 Slideshow
I’ve been using the jQuery Cycle plugin for as long as I can remember, and have even blogged about it in the past. Recently I tried the second version of the plugin, aptly named ‘Cycle 2‘, which worked just as well and is definitely an improvement on the original.
One issue I came across when using the Cycle 2 plugin was that I couldn’t work out how to get the current slide as I wanted to use the current slides index in a callback.
After looking at the documentation it simply reads:
“The Cycle2 options hash contains all of the slideshow’s options detailed above, along with the following additional pieces of run-time state”
Yet, no where does it give an example of how to access this information. As a result I went digging through the plugin code and managed to figure it out for myself:
So there we have it, how to obtain the current slide index. You can then do with it as you wish.