I have a slide show in which a plugin with a huge loop is running, and when you click a button in the show, I show a hidden layer on the page and send a pause command for the loop. I have two problems:
When the pause command is received, the loop immediately goes back to the 1st slide in the sequence (why?) And does not hit my callbacks before / after.
After closing the layer, I send the resume command to the loop. The slideshow resumes (from the first slide, where the pause left it), but now the loop does not call mine before / after callbacks at all, even as the slideshow advances.
So, I think, my question is: how to properly pause / resume the slide show so that these strange behaviors do not occur? (And to be completely clear and to avoid confusion, this is not about the “pause on hang” function, which actually works great for me. :-)
Here is my init loop () and my callback functions. (Why am I manually tracking nextSlide, you ask? Because the built-in value for the current slide is not updated properly for callbacks before / after.)
$(document).ready(function() {
$('#slideshow').cycle({
fx: 'fade',
timeout: 4000,
speed: 1000,
pause: 1,
delay: 0,
slideExpr: 'img',
before: moveArrow,
after: upd,
fastOnEvent: 'fast',
});
});
var nextSlide = 0;
function upd(a, b, c) {
nextSlide = nextSlide + 1;
c = $('#slideshow img').length;
if(nextSlide > (c - 1)) nextSlide = 0;
}
function moveArrow(a, b, c) {
$('#slide-indicator').attr('class', 'c'+nextSlide);
$(".clickmap").hide();
$(".clickmap.c"+nextSlide).show();
return true;
}
Thanks for any thoughts on this -
better Eric
source
share