views:

19

answers:

1

Hi guys,

I'm using jQuery and the cycle plugin to simply rotate some images.

On a mouse even I ask it to pause,

$('.content-main-imgholder', this).cycle('pause');

My question is how can now detect if the cycle is paused? i.e.

if( cycle = pause ) {
//do something
}

Thanks in advance for your help.

A: 

It adds a cyclePause property on the element (set to 1 when paused), so you can check like this:

if($('.content-main-imgholder', this)[0].cyclePause) {
  //do something
}

This checks the first element, if you have many you could loop through and check each, just depends what you're trying to do if you do have multiple instances (or if you're pausing them all, like the question, checking the first may still suffice).

Nick Craver
Thanks Nick, this has done exactly what I need. Are these properties documented anywhere?
Sam
@Sam - I don't think so, I was looking at the source to see what it did :)
Nick Craver
Thanks again Nick. I have firebug, but I still can't seem to find where cyclepause is set. What software do you use?
Sam
@Sam - I personally use Chrome most of the time, but I found this in the cycle plugin's code, just looking at the uncompressed `.js` file.
Nick Craver
Thanks Nick, super stuff.
Sam