jQuery Cycle plugin- How to return the index number of the currently displayed slide?
Asked Answered
C

2

11

I'm currently using Malsup's Cycle plugin . I am just wondering is it possible to have cycle plugin return the index number of the currently displayed slide??

I want to change the content of the page when a specific slide is active. Don't know how to achieve that..

Complexity answered 26/11, 2011 at 5:44 Comment(0)
I
12

You can do this:

//on before function
before: function (curr, next, opts) {
    alert(opts.nextSlide + " of " + opts.slideCount);
} 

Hope it helps

Injurious answered 26/11, 2011 at 5:50 Comment(2)
Thanks so much Sudhir! I'm a beginner in coding, how do I return the current slide number as a variable oppose to popping an alert like the one you showed me? Thanks!Complexity
var current = opts.nextSlide;Bassinet
D
4

To get the current slide use:

before: function (curr, next, opts) {
    alert("Current slide " + opts.currSlide);
}
Disbelief answered 18/5, 2013 at 20:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.