jcycle plugin - adding a title to the cycling images
I've built a slideshow with images (with anchors) as the nav. And now i'm trying to
add a caption to the main image. But it's not pulling in the text. The images
and the nav are cycling quite prettily, but the <div id="caption"></div> isn't
being filled with the alt text of the image.
$(document).ready (function (){
$('#slideshow').cycle({
after: addCaption,
fx: 'fade',
speed: 'fast',
timeout: 3000,
pager: '#nav',
pagerEvent:'mouseover',
pagerAnchorBuilder: function(idx, slide) {
// return selector string for existing anchor
return '#nav li:eq(' + idx + ') a'; }
});
function addCaption() {
var title = $(this).attr('alt');
$('#caption').html(title);
}
});