Fix FancyBox in the list view of Explorer
This commit is contained in:
parent
5da19afed3
commit
e5d4f26fc2
@ -447,7 +447,7 @@ jQuery(document).ready(function($)
|
|||||||
else
|
else
|
||||||
result += '<td> </td>'
|
result += '<td> </td>'
|
||||||
|
|
||||||
result += '<td><a data-fancybox="exposition-list" href="';
|
result += '<td><a class="list-preview" data-fancybox="exposition-list" href="';
|
||||||
if (i.photo == "none")
|
if (i.photo == "none")
|
||||||
result += 'images/unknown.jpg';
|
result += 'images/unknown.jpg';
|
||||||
else
|
else
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
function fancyboxInit(data, explorer)
|
function fancyboxInit(data, explorer)
|
||||||
{
|
{
|
||||||
$('[data-fancybox="exposition"], [data-fancybox="exposition-list"]').fancybox(
|
$('[data-fancybox="exposition"]').fancybox(
|
||||||
{
|
{
|
||||||
selector: '.gallery a',
|
selector: '.gallery a',
|
||||||
infobar: false,
|
infobar: false,
|
||||||
@ -14,7 +14,31 @@ function fancyboxInit(data, explorer)
|
|||||||
preventCaptionOverlap: true,
|
preventCaptionOverlap: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
caption: function(instance, item)
|
caption: function(instance, item) { return caption(item, data); },
|
||||||
|
beforeShow : function(instance, current) { return beforeShow(instance, current); },
|
||||||
|
afterClose : function(instance) { return afterClose(instance); }
|
||||||
|
});
|
||||||
|
|
||||||
|
$('[data-fancybox="exposition-list"]').fancybox(
|
||||||
|
{
|
||||||
|
selector: 'a.list-preview',
|
||||||
|
infobar: false,
|
||||||
|
toolbar: true,
|
||||||
|
smallBtn: false,
|
||||||
|
buttons: ["arrowLeft", "arrowRight", "close"],
|
||||||
|
arrows: false,
|
||||||
|
transitionEffect: "fade",
|
||||||
|
baseClass: 'fancybox-custom-layout',
|
||||||
|
mobile: {
|
||||||
|
preventCaptionOverlap: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
caption: function(instance, item) { return caption(item, data); },
|
||||||
|
beforeShow : function(instance, current) { return beforeShow(instance, current); },
|
||||||
|
afterClose : function(instance) { return afterClose(instance); }
|
||||||
|
});
|
||||||
|
|
||||||
|
function caption(item, data)
|
||||||
{
|
{
|
||||||
var idx = 0; // search the index of the painting of filtered data
|
var idx = 0; // search the index of the painting of filtered data
|
||||||
for (i = 0; i < data.length; i++)
|
for (i = 0; i < data.length; i++)
|
||||||
@ -39,22 +63,23 @@ function fancyboxInit(data, explorer)
|
|||||||
if (data[idx].comment != '—')
|
if (data[idx].comment != '—')
|
||||||
cartel += '<span class="comment">' + data[idx].comment + '</span>';
|
cartel += '<span class="comment">' + data[idx].comment + '</span>';
|
||||||
cartel += '</div>';
|
cartel += '</div>';
|
||||||
|
|
||||||
return cartel;
|
return cartel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return generateCartel();
|
return generateCartel();
|
||||||
},
|
}
|
||||||
|
|
||||||
beforeShow : function(instance, current)
|
function beforeShow(instance, current)
|
||||||
{
|
{
|
||||||
if (current.opts.fancyboxIndex > previousArray[previousArray.length - 1])
|
if (current.opts.fancyboxIndex > previousArray[previousArray.length - 1])
|
||||||
$('#pagination').pagination('next');
|
$('#pagination').pagination('next');
|
||||||
|
|
||||||
if (current.opts.fancyboxIndex < previousArray[0])
|
if (current.opts.fancyboxIndex < previousArray[0])
|
||||||
$('#pagination').pagination('previous');
|
$('#pagination').pagination('previous');
|
||||||
},
|
}
|
||||||
|
|
||||||
afterClose : function(instance)
|
function afterClose(instance)
|
||||||
{
|
{
|
||||||
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
|
// after closing, changing the URL again. I guess there's no better way except by changing fancybox code...
|
||||||
// (apparently fancybox changes back to the original url it had when starting)
|
// (apparently fancybox changes back to the original url it had when starting)
|
||||||
@ -67,5 +92,5 @@ function fancyboxInit(data, explorer)
|
|||||||
else
|
else
|
||||||
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
|
window.history.replaceState('', '', window.location.pathname + '?page=' + currentPage + window.location.hash);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user