javascriptjqueryjquery-cycle

Is there a way in jQuery Cycle to retrieve a parameter?


Is there a way, in jQuery Cycle, to retrieve a parameter?

Example

$('#slider').cycle({speed: 750})

How can I, in Javascript/jQuery, retreive the value 750?

I tried
console.log( $('#slider').cycle.speed )
console.log( $('#slider').cycle.('speed') )

but the value is undefined


Solution

  • I don't see any plugin commands which allow you to retrieve the value. However, exploring the results with Firebug, it appears that the plugin stores its options under the cycle.opts data attribute. If you really need to get at the value, you can use:

    $('#pics').data("cycle.opts").speed
    

    Demo: http://jsfiddle.net/ZWDa4/

    Note that this is not an ideal solution since there's no guarantee that it will continue to work with future updates.