从 Alt 属性向 jQuery Cycle 幻灯片添加标题?
我正在制作幻灯片,需要为循环的每张图片显示一个标题。我为它们创建了 alt 属性,并尝试为每个图像循环显示它们,但它只显示第一个图像。我不确定如何将我拥有的代码放入画廊的循环“循环”中?这有道理吗?这就是我所拥有的,(嗯,我的意思是其中的一部分):)谢谢!
$('#slideshow').before('<div class="navigation">').cycle({
fx: 'fade',
timeout: 6000,
pager: '.navigation'
});
$('.image_title').html($(this).find('img').attr('alt'));
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'));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需将该代码移至回调之前或之后即可。例如:
Just move that code into the before or after callback. For example: