You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.5 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

$(document).ready(function() {
/* initialize shuffle plugin */
var $grid = $('.gallery');
$grid.shuffle({
itemSelector: '.item-wrapper' // the selector for the items in the grid
});
$('#galleryfilter button').click(function (e) {
    e.preventDefault();
 
    // set active class
    $('#galleryfilter button').removeClass('active');
    $(this).addClass('active');
 
    // get group name from clicked item
    var groupName = $(this).attr('data-group');
 
    // reshuffle grid
    $grid.shuffle('shuffle', groupName );
});
$('#gallerysort button').click(function (e) {
    e.preventDefault();
    // set active class
    $('#gallerysort button').removeClass('active');
    $(this).addClass('active');
 
// set sorts
var opts = {};
if ($(this).attr('data-order')=="desc") {
opts = {
by: function($el) {
return $el.data('name').toLowerCase();
}
}
} else {
opts = {
reverse: true,
by: function($el) {
return $el.data('name').toLowerCase();
}
}
}
$grid.shuffle('sort', opts);
});
$(".gallery img").click(function(e) {
e.preventDefault();
var img = $(this).attr("src");
var imgname = $(this).closest(".item-wrapper").attr("data-name");
bootbox.dialog({
message: "<img src='" + img + "' class='img-responsive' />",
title: imgname,
buttons: {
close: {
label: "Close",
className: "btn-default"
}
}
});
});
});