> The code shown below is working fine for me, but I want the prev and
> next buttons to jump 2 slides instead of 1. I think this involves the
> "prevNextClick" option, but don't know how to code it...
>
> <script type="text/javascript">
> $(function() {
> $('#liberiaSlideshow').cycle({
> fx: 'fade',
> delay: 1000,
> speed: 'slow',
> timeout: 3600,
> timeoutFn: calculateTimeout,
> prev: '#prevButton',
> next: '#nextButton'
> });
>
> });
Hmm, this is a tough one. Cycle doesn't really do much to help you
with this, other than exposing its internal state. Haven't tested
this, but here's what I'd try:
var cycleOpts;
$('#prevButton').click(function() {
var next, index = cycleOpts.currSlide;
if (index == 0)
next = cycleOpts.slideCount - 2;
else if (index == 1)
next = cycleOpts.slideCount - 1;
else
next = index - 2;
$('#liberiaSlideshow').cycle(next);
});
$('#nextButton').click(function() {
var next, index = cycleOpts.currSlide;
if (index == cycleOpts.slideCount - 1)
next = 1;
else if (index == cycleOpts.slideCount - 2)
next = 0;
else
next = index + 2;
$('#liberiaSlideshow').cycle(next);
});
$('#liberiaSlideshow').cycle({
fx: 'fade',
delay: 1000,
speed: 'slow',
timeout: 3600,
timeoutFn: calculateTimeout,
// prev: '#prevButton',
// next: '#nextButton',
before: onBefore
});
function onBefore(curr,next,opts) {
cycleOpts = opts;
}