Cookbook /
MiniFancybox-Talk
Summary: Talk page for Mini with Fancybox.
Maintainer: Petko
This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.
Broken with mini 20190906
To properly works fancybox rely on rel attribute in <a href> tag that surrounding each images of the mini gallery.
But this has been replaced by a new data-lightbox attribute.
Solution :
Change the mini-fancybox.js script to reintroduce the rel attribute making fancybox works again :
// This file was created by Petko Yotov | http://pmwiki.org/Petko
// for the purposes of the Mini gallery for PmWiki. (20110817)
var MiniFancyboxOptions = {
'type': 'image',
'titlePosition': 'inside',
'padding': 2,
'margin': 10
};
$(document).ready(function () {
var MiniTitleFmt = function (T, CA, CI, CO) {
// title, currentArray, currentIndex, currentOpts
var cnt = (CA.length == 1 || MiniFancyboxOptions.enableKeyboardNav == false) ? '' :
'<span style="float: right;">' + (CI + 1) + ' / ' + CA.length + '</span> ';
if (cnt.length + T.length == 0) return '';
return '<span id="fancybox-title-' + MiniFancyboxOptions.titlePosition + '">' + cnt + T + '</span>';
};
MiniFancyboxOptions.titleFormat = MiniTitleFmt;
var Rels = {};
$("a[data-lightbox^=lightbox]").each(function () {
Rels[$(this).attr('data-lightbox')] = 1;
$(this).attr('rel', 'lightbox_mini');
});
for (var i in Rels) {
if (i == "lightbox") {
MiniFancyboxOptions.showNavArrows = false;
MiniFancyboxOptions.enableKeyboardNav = false;
}
$("a[rel=" + i + "]").fancybox(MiniFancyboxOptions);
}
});
AntonyTemplier April 16, 2021, at 08:59 AM
This must have been fixed since Fancybox works in the demo page. Apparently you have started from an older version 20110817, current version is 20181115. --Petko April 16, 2021, at 10:50 AM
Talk page for the Mini with Fancybox recipe (users).