Adjust jQuery.cycle values programmatically

Blog

When using the jQuery.Cycle plugin, the settings are configured on setup. Sometimes, however, you want to adjust them on the fly: adjust the speed in a subsequently loaded javascript file, adjust the speed based on hover or click, etc.

To do so, use the data element to get the cycle.opts values:

  var cycleopts = jQuery("#some-cycle").data('cycle.opts');

And change the values in particular to adjust:

  if (typeof jQuery("#some-cycle").cycle == 'function') {
    jQuery("#some-cycle").data('cycle.opts').timeout = 9000;
  }

All the cycle options are at http://jquery.malsup.com/cycle/options.html