Jquery Cycle, multiple slideshows -> breaks when slideshow div only contains single image
Hello,
I'm trying to make the jquery cycle plugin work for multiple galleries on a single page. In general it works fine, but when a slideshow only contains a single image it will break the slideshow
Here is the code:
- $(document).ready(function() {
//cycle options for news section
$('.slideshownews').each(function(){
var p = this.parentNode;
$(this).cycle({
speed: 200,
timeout: 600,
fx: 'fadeout',
prev: $('.prev', p),
next: $('.next', p),
before: onBefore,
after: onAfter,
}).cycle("pause").hover(function() {
$(this).cycle('resume');
},function(){
$(this).cycle('pause');
});
//onBefore
function onBefore(curr, next, opts, fwd) {
};
//onAfter
function onAfter(curr, next, opts, fwd) {
// caption
$('.slideshowcaption p:visible', p).hide();
var index=opts.currSlide;
$('.slideshowcaption p', p).eq(index).show();
// image count
var imagecount = '| Image ' + (opts.currSlide + 1) + ' of ' + opts.slideCount;
$('.countnews', p).html(imagecount);
};
});
});
I would appreciate your help!