I am using a caption for a title in FancyBox 2. I grabbed the code from here: http://jsfiddle.net/vkDcG/
$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
beforeLoad: function() {
this.title = $(this.element).attr('caption');
}
});
It works fine. I want to change the image transitions from elastic to fade.
Code taken from here: Links within caption on Fancybox 2.
$(document).ready(function() {
$(".fancybox").fancybox({
openEffect : 'fade',
closeEffect : 'fade',
nextEffect : 'fade',
prevEffect : 'fade',
helpers : {
title : {
type : 'inside'
},
overlay : {
css : {
'background-color' : '#eee'
}
}
}
});
});
When I add the fade transition, the caption text is not used but it defaults to the title text (which I am using for something else). Kinda stumped as to why this is not working. Any help would greatly be appreciated.
Here is my code:
$(".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');
}
});