Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 345
Newcomer Avatar asked Nov 26 '11 05:11

Newcomer


People also ask

What does index () return in jQuery?

If a selector string is passed as an argument, .index () returns an integer indicating the position of the first element within the jQuery object relative to the elements matched by the selector. If the element is not found, .index () will return -1.

How to find the first element in a jQuery collection?

A selector representing a jQuery collection in which to look for an element. The DOM element or first element within the jQuery object to look for. If no argument is passed to the .index () method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements.

How to find the position of the first element in jQuery?

The DOM element or first element within the jQuery object to look for. If no argument is passed to the .index () method, the return value is an integer indicating the position of the first element within the jQuery object relative to its sibling elements.

How to get the zero-based position of a list item using jQuery?

Again, we get back the zero-based position of the list item: On click, returns the index (zero-based) of that div in the page. Returns the index for the element with ID bar. Returns the index for the first item in the jQuery collection. Returns the index for the element with ID bar in relation to all <li> elements.


1 Answers

You can do this:

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

Hope it helps

like image 176
Sudhir Bastakoti Avatar answered Oct 05 '22 13:10

Sudhir Bastakoti