var _gallerygrids_widths = [];
$(document).ready(function() {
checkGalleryGrids();
$(window).on('resize', function(){
checkGalleryGrids();
});
});
function checkGalleryGrids() {
var divider = 4;
if ($("#mq-detector .visible-xs").is(':visible')) {
divider = 2;
}
$(".list_gallerygrid_container").each(function(i, e) {
var w = $(this).width();
if (w != _gallerygrids_widths[$(this).attr("id")]) {
_gallerygrids_widths[$(this).attr("id")] = w;
var children = '#' + $(this).attr("id") + " .list_gallerygrid_item";
$(children).each(function(i, e) {
var item_h = w / divider;
$(this).css({ height: item_h + "px" });
});
}
});
}