coffeescript - jQuery cycle.all.js first slide timeout -
i'm using cycle.all.js jquery plugin (http://jquery.malsup.com/cycle/). right it's working fine, need first image have shorter timeout rest. when user first hovers mouse on slideshow-div cycle begins immediately, after first slide changes timeout 650. how code looks right now:
$('div#slideshow').mouseenter(-> $(this).cycle fx: "fade", speed: 1 timeout: 650 ).mouseleave -> $(this).cycle 'stop'
you can delay
option , give negative value:
$(this).cycle fx: "fade", speed: 1 timeout: 650 delay: -650 )
note causes go immediately second slide, think want, since first image of slideshow visible before user hovers on it.
as benjamin pointed out, in coffeescript can use @
shortcut this
:
$('div#slideshow').mouseenter(-> $(@).cycle fx: "fade", speed: 1, timeout: 650, delay: -650 //go next slide ).mouseleave -> $(@).cycle 'stop'
Comments
Post a Comment