views:

232

answers:

1

I am building a slideshow and need to have a title appear for each picture that get cycled. I created alt attributes for them and am trying to have cycle display them for each image, but It only shows the first one. I am unsure how to get the code I have into the cycle "loop" for the gallery? Does this make sense? here is what I have, (well, part of it I mean) :) thanks!

$('#slideshow').before('<div class="navigation">').cycle({
fx:     'fade',
timeout: 6000,
pager:  '.navigation'
});

$('.image_title').html($(this).find('img').attr('alt'));
A: 

Just move that code into the before or after callback. For example:

$('#slideshow').before('<div class="navigation">').cycle({
    fx:     'fade',
    timeout: 6000,
    pager:  '.navigation',
    after:   function() {
        var title = $(this).attr('alt');
        $('.image_title').html(title);
    }
});
malsup