我在 FancyBox 2 中使用标题作为标题。我从这里获取了代码:http: //jsfiddle.net/vkDcG/
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
beforeLoad: function() {
this.title = $(this.element).attr('caption');
}
});
它工作正常。我想将图像过渡从弹性更改为淡出。
取自此处的代码:Fancybox 2 标题内的链接。
$(document).ready(function() {
$(".fancybox").fancybox({
openEffect : 'fade',
closeEffect : 'fade',
nextEffect : 'fade',
prevEffect : 'fade',
helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background-color' : '#eee'
}
}
}
});
});
当我添加淡入淡出过渡时,不使用标题文本,但它默认为标题文本(我将其用于其他内容)。有点难为为什么这不起作用。任何帮助将不胜感激。
这是我的代码:
$(".fancybox")
.fancybox({
openEffect : 'fade',
closeEffect : 'fade',
nextEffect : 'fade',
prevEffect : 'fade',
helpers : {
title : null
overlay : {
css : {
'background-color' : '#4a4a4a'
}
}
},
beforeLoad: function() {
this.title = $(this.element).attr('caption');
}
});