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..

Yahel
  • 37,023
  • 22
  • 103
  • 153
Newcomer
  • 135
  • 1
  • 6

2 Answers2

12

You can do this:

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

Hope it helps

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
  • 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! – Newcomer Nov 26 '11 at 06:47
  • 1
    var current = opts.nextSlide; – Gregg B Nov 26 '11 at 15:08
4

To get the current slide use:

before: function (curr, next, opts) {
    alert("Current slide " + opts.currSlide);
}
ellroy35
  • 438
  • 4
  • 5