views:

91

answers:

3

I'm running into a problem with jQuery, so I think I've figured out a workaround, but need help.

I currently attach a cycle() slideshow to my div like this:

function startSlideshow() {
    $('#slideshow').cycle({ some parameters });
}

When I pause and restart this slideshow, it exhibits weird behavior, due to bugs in the cycle plugin. So my workaround idea is this: to destroy the existing cycle() and then just recreate it on the fly.

I can easily recreate it by calling startSlideshow() again... but how do I kill the old cycle() that's attached to the div?

I guess I'm looking for a way to "unset" or "unbind" it completely (and jQuery's unbind() method isn't it).

Thanks-- Eric

+2  A: 

Use the the plugins destroy command, it has been added to version 2.80

$('#slideshow').cycle('destroy');
Marko
Hmm. Strangely, 'destroy' seems to leave it in a weird state. Calling 'destroy' and then immediately starting it again definitely does not restart it normally.
Eric
+1  A: 

You can use $('#slideshow').cycle('destroy');

But are you sure the weird behaviour is due to the cycle plug-in having bugs ? and not improper usage of it ?

How do you pause and restart the cycling ?

Gaby
Hi Gaby-- as best I can tell, there are some issues with the z-index and how cycle() handles things. My page is really complicated and I can't easily reproduce it outside of the page, but I'm definitely calling it normally. Check out the link in the 1st line of my question (above, top of this page) to see the other question I posted, and you can see how I'm calling the code. Thanks for the reply.
Eric
A: 

Hi,

I am experiencing similar problems and cycle('destroy') does not seem to work (actually, it does not seem to do anything. Could that be a bug in the plugin or can anyone verify the destroy command is working?

Thanks a lot in advance, Christiane

Christiane
Just an FYI http://stackoverflow.com/faq "Can I use a signature or tagline?". That said, being polite is always encouraged :)
Mark Schultheiss