42 lines
1.7 KiB
JavaScript
42 lines
1.7 KiB
JavaScript
jQuery(document).ready(function($)
|
|
{
|
|
$.getJSON("data.json", function(data)
|
|
{
|
|
for (i of data)
|
|
{
|
|
if (i.photo == "ok" || i.photo == "good")
|
|
{
|
|
paintingHtml = '<a data-fancybox="exposition" href="photos/paintings/normal/' + i.number + '.jpg" data-fancybox-index="' + i.number + '">'
|
|
paintingHtml += '<img src="photos/paintings/mini/' + i.number + '.jpg"></a>';
|
|
$("#gallery").append(paintingHtml);
|
|
}
|
|
}
|
|
|
|
$('[data-fancybox="exposition"]').fancybox(
|
|
{
|
|
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)
|
|
{
|
|
var idx = item.opts.fancyboxIndex - 1; // painting number
|
|
return '\
|
|
<div id="info">\
|
|
<span class="info"><a href="painting.html?number=' + data[idx].number + '">ℹ︎</span></a></span>\
|
|
<span class="title">' + data[idx].title + '</span><span class="year">' + (data[idx].month != '—' ? data[idx].month + ' ' : '') + data[idx].year + '</span>\
|
|
<span class="format">' + data[idx].paint + ' sur ' + data[idx].support + ' (' + data[idx].dimension + ')</span>\
|
|
<span class="comment">' + data[idx].comment + '</span>\
|
|
</div>\
|
|
';
|
|
}
|
|
});
|
|
});
|
|
}); |