使用嵌套幻灯片将字幕挂接到 Jquery Cycle 中
我试图弄清楚如何让 Jquery 循环显示给定以下脚本的标题。虽然 Jquery Cycle 页面上的常见标题演示要求使用 after:
回调来显示标题,但由于 after:<此脚本中的 /code> 回调用于触发活动图库的启动。任何帮助将不胜感激。
$(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'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 script 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'
});
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在这里解释了
将标题添加到嵌套 Jquery 循环
您可以从任何地方获取标题内容你想要的。最简单的方法是获取替代文本(如果给定),或者您需要一个额外的脚本,该脚本从存储每个图像信息的数据库或文件中选择文本。
此处的实例 http://ferienhaus-fischland-ahrenshoop.de/mini4/
(完成此项目后,您需要删除“mini4/”)
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/")