Your question is about Cycle specifically, not general jQuery. The documentation on options for Cycle can be found here.
It looks like there is an event called onPrevNextEvent
:
onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
The second parameter passed into a function you define for that event will be zeroBasedSlideIndex
. That's your current slide number, with the first slide starting at 0.
So your code might look something like:
$(document).ready(function() {
$(".slideshow").css("overflow","hidden");
$("ul#slides").cycle({
fx: 'fade',
pause: 1,
prev: '#prev',
next: '#next',
onPrevNextEvent: function(isNext, slideNum) {
alert("This is slide "+ slideNum);
}
});