Alex Barber | Digital Artist

time to push the pixels

jQuery Cycle – pause on last item

http://stackoverflow.com/questions/6064893/jquery-cycle-plugin-delay-interval-between-slides-question

http://jsfiddle.net/7jJe3/

function timeoutfn(currSlideElement, nextSlideElement, options, forwardFlag) {
var imgtime = 5000;
var blanktime = 2000;
if ($(currSlideElement).is('img'))
return imgtime;
return blanktime;
};

$(function() {
$('#slideshow').cycle({
fx: 'fade',
speed: 400,
timeoutFn: timeoutfn
});
});

I tweaked the code to check if the image was the last one within a container div, and if so, pause on it.

function timeoutfn(currSlideElement, nextSlideElement, options, forwardFlag) {
var imgtime = 500;
var blanktime = 7000;
var lastimg = $('#heroimg img:last');
if ($(currSlideElement).is(lastimg))
return blanktime;
return imgtime;
};

Next Post

Previous Post

© 2022 Alex Barber | Digital Artist