Hooking Captions into Jquery Cycle with nested slideshows
I'm trying to figure out how to get Jquery cycle to show captions given the following script. Though the usual caption demos on the Jquery Cycle page call for the usage of after:
callback to show captions, I've been unable to get it work due to the fact that the after:
callback in this s开发者_高级运维cript is being used to trigger the start of the active gallery. Any help would be appreciated.
$(document).ready(function() {
gLength = $('#hovergal > div').size();
if( gLength > 1)
{
//move over gallery to allow room for nav
$('#hovergal').css("marginLeft","160px");
//stop subgal initially
$('#hovergal .subgal').cycle({
fx: 'fade',
timeout: 3000,
slideExpr: 'img'
}).cycle('pause');
//start subgal on click
$('#hovergal').cycle({
fx: 'scrollUp',
speed: 300,
timeout: 0,
slideExpr: '>div.subgal',
pager: 1,
pagerAnchorBuilder: function(i) {
return $('aside.sgnav a:eq(' + i + ')');
},
after: function(curr,next,opts) {
var cmd = opts.currSlide == 1 ? 'resume' : 'pause';
$('div.subgal').cycle(cmd);
},
before: function() {
$('.caption').html(this.alt);
}
});
} else {//else, if there's only one gallery to be shown
$('#hovergal .subgal').cycle({
fx: 'fade',
timeout: 3000,
slideExpr: 'img'
});
}
});
I explained it on here Add captions to nested Jquery Cycle
you may take the content for the caption from wherever you want. The easiest way is to take the alt-Text, if given, or you need an additional script, which selects text from a database or files, where you stored the informations for each image.
Live example on here http://ferienhaus-fischland-ahrenshoop.de/mini4/ (after finishing this project you need to remove the "mini4/")
精彩评论