Change Cycle plugin fx dynamically?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Change Cycle plugin fx dynamically?

JohnnyCee

I'm using the Cycle plugin and I'd like to change the transition
effect dynamically. I tried stopping the show and restarting by
calling ".cycle()" with different options, but it didn't work
properly. Some of the slides would be missing and the animations
didn't always operate correctly.

Is there a recommended way to change the fx on the fly?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Change Cycle plugin fx dynamically?

malsup

> I'm using the Cycle plugin and I'd like to change the transition
> effect dynamically. I tried stopping the show and restarting by
> calling ".cycle()" with different options, but it didn't work
> properly. Some of the slides would be missing and the animations
> didn't always operate correctly.


Hi Johnny,

That functionality is currently not supported by the plugin.  The
approach you took is the best approach for now, but the challenge is
that you need to restore the slides to their original settings.
Depending on what transition effects you're using, some slides may
have a zero height or width when you restart the slideshow and that
creates problems for the next effect.  If you have a very basic
structure where all slides are the same size you may have luck using
the 'fit' option.

Mike
Reply | Threaded
Open this post in threaded view
|

Re: Change Cycle plugin fx dynamically?

JohnnyCee

On Dec 14, 10:02 am, Mike Alsup <[hidden email]> wrote:
> That functionality is currently not supported by the plugin.  The
> approach you took is the best approach for now, but the challenge is
> that you need to restore the slides to their original settings.
> Depending on what transition effects you're using, some slides may
> have a zero height or width when you restart the slideshow and that
> creates problems for the next effect.  If you have a very basic
> structure where all slides are the same size you may have luck using
> the 'fit' option.

Mike,

Thanks for responding! I thought that the issue might have to do with
modified CSS parameters for the slides but I couldn't think of an
easy, reliable way to reset them. I'll see if using 'fit' does the
trick.

This is for a demo page and so I may change it from an on-page example
to a popup. Hmm. Thinking about that, if I can create the HTML
dynamically for the popup, I could do something similar for an on-page
version. Perhaps I'll keep the basic HTML somewhere out of site and
then create the container DIV and its contents the first time and all
subsequent times...

John
Reply | Threaded
Open this post in threaded view
|

Re: Change Cycle plugin fx dynamically?

JohnnyCee

An update...

I got a page to work where I change the Cycle "fx" parameter
dynamically. Basically, I reconstruct the HTML for the slides
dynamically and then call Cycle() on it. The page is not online yet;
when it is, I'll post a URL to it.
Reply | Threaded
Open this post in threaded view
|

Re: Change Cycle plugin fx dynamically?

gion13
In reply to this post by JohnnyCee
you can change the fx dynamically.  
You should write all of your desired effects (if they don't ready exists) and then you can make an fx that returns one of them based on your  "dynamic" conditions.
Here's an example :

$.fn.cycle.transitions.dynamic = function(){
    var fx = Math.random() > 0.5 ? "scrollHorz" : "scrollVert";
    return $.fn.cycle.transitions[fn].apply(this,arguments);
}

So in this example, based on "randomness" your plugin dynamically updates the fx to  'scrollVert' or 'scrollHorz'.
JohnnyCee wrote
I'm using the Cycle plugin and I'd like to change the transition
effect dynamically. I tried stopping the show and restarting by
calling ".cycle()" with different options, but it didn't work
properly. Some of the slides would be missing and the animations
didn't always operate correctly.

Is there a recommended way to change the fx on the fly?

Thanks!