Gallery view in "explorer"
Also fixed some issues with cartel CSS
This commit is contained in:
@ -179,12 +179,10 @@ jQuery(document).ready(function($)
|
||||
}
|
||||
|
||||
|
||||
/***********/
|
||||
/** TABLE **/
|
||||
/***********/
|
||||
/*********************/
|
||||
/** TABLE & GALLERY **/
|
||||
/*********************/
|
||||
|
||||
function generateTable()
|
||||
{
|
||||
function checkYear(year)
|
||||
{
|
||||
if (paramYear == "all") return true;
|
||||
@ -256,11 +254,7 @@ jQuery(document).ready(function($)
|
||||
{
|
||||
if (paramTag == "all")
|
||||
return true;
|
||||
console.log("tag: " + tag);
|
||||
console.log("paramTag: " + paramTag);
|
||||
|
||||
splitTag = tag.split(", ");
|
||||
console.log(splitTag);
|
||||
|
||||
for (t of splitTag)
|
||||
{
|
||||
@ -288,6 +282,8 @@ jQuery(document).ready(function($)
|
||||
return false;
|
||||
}
|
||||
|
||||
function generateTable()
|
||||
{
|
||||
hasResult = false;
|
||||
|
||||
for (i of data)
|
||||
@ -313,6 +309,7 @@ jQuery(document).ready(function($)
|
||||
|
||||
hasResult = true;
|
||||
|
||||
// table
|
||||
$("table").css("display", "block");
|
||||
|
||||
result = "<tr>";
|
||||
@ -343,17 +340,32 @@ jQuery(document).ready(function($)
|
||||
result += "</tr>";
|
||||
|
||||
$("table").append(result);
|
||||
|
||||
// gallery
|
||||
if (i.photo == "none")
|
||||
{
|
||||
paintingHtml = '<a data-fancybox="exposition" href="images/unknown.jpg" data-fancybox-index="' + i.number + '">'
|
||||
paintingHtml += '<img src="images/unknown.jpg"></a>'
|
||||
}
|
||||
else
|
||||
{
|
||||
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);
|
||||
}
|
||||
return hasResult;
|
||||
}
|
||||
|
||||
$("#gallery").hide();
|
||||
$(".style-select").hide();
|
||||
|
||||
generateMenu();
|
||||
|
||||
var res = generateTable();
|
||||
// display table or no result depending of computed result
|
||||
if (res)
|
||||
|
||||
if (res) // display table or no result depending of computed result
|
||||
{
|
||||
$(".style-select").show();
|
||||
$("article.explorer h2").removeClass("active")
|
||||
$("form").slideUp(200);
|
||||
}
|
||||
@ -363,15 +375,51 @@ jQuery(document).ready(function($)
|
||||
// on mobile, show only the first item slided down
|
||||
if ($(window).width() <= 600)
|
||||
{
|
||||
console.log($(window).width());
|
||||
$("article.explorer .container .box").each(function()
|
||||
{
|
||||
console.log("hi");
|
||||
if (!$(this).hasClass('active'))
|
||||
{
|
||||
$(this).children(".item-cont").slideUp(200);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// change display: gallery/table
|
||||
$(".style-select.frame").click(function()
|
||||
{
|
||||
$("table").hide();
|
||||
$("#gallery").show();
|
||||
})
|
||||
$(".style-select.list").click(function()
|
||||
{
|
||||
$("#gallery").hide();
|
||||
$("table").show();
|
||||
})
|
||||
|
||||
|
||||
// fancybox configuration
|
||||
$('[data-fancybox="exposition"]').fancybox(
|
||||
{
|
||||
infobar: false,
|
||||
toolbar: true,
|
||||
smallBtn: false,
|
||||
buttons: ["arrowLeft", "arrowRight", "close"],
|
||||
arrows: false,
|
||||
transitionEffect: "fade",
|
||||
baseClass: 'fancybox-custom-layout',
|
||||
|
||||
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>\
|
||||
';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
@ -6,10 +6,8 @@ jQuery(document).ready(function($)
|
||||
{
|
||||
if (i.photo == "ok" || i.photo == "good")
|
||||
{
|
||||
console.log(i.number);
|
||||
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>';
|
||||
console.log(paintingHtml);
|
||||
$("#gallery").append(paintingHtml);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user