开发者

Add title to jQuery Cycle slideshow from Alt attribute?

I am building a slideshow and need to have a title appear for each picture that get cycled. I created alt attributes for the开发者_开发技巧m 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'));


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);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜