jQuery Cycle2 per-slide speed option

2019-07-26 06:58发布

I can change timeout using the timeoutFn. How can I do the same for speed? I seached and could not find any way other that having the data-speed attribute on the slide elements. Is there any way to change that programmatically?

$('.slideshow').cycle({
                speed: 100,
                timeoutFn: calculateTimeout,
                slides: "li",
                fx: 'scrollLeft,scrollDown,scrollRight'
});

function calculateTimeout(currElement, nextElement, opts, isForward) { 
        var currentElementTransition = $(currElement).attr('data-timeout');
        return parseInt(currentElementTransition, 10) || 0; 
} 

0条回答
登录 后发表回答