$(function () { /* * Timeframe select, hardcoded * */ var timeframeselect = new SlimSelect({ select: '#timeframe-select', beforeOpen: function () { $('[data-index-filter]').each(function () { var $target = $(this); $target.data('slimselect').close(); }) } }); //set data for timeframe $("#timeframe-select").data('slimselect', timeframeselect); /* * Loop through every item in pagebuilder settings widget and make SlimSelect * */ $.each(window.item_array, function (i, val) { val.var = new SlimSelect({ select: val.select, allowDeselectOption: true, closeOnSelect: false, beforeOpen: function () { $('[data-index-filter]').each(function () { var $target = $(this); $target.data('slimselect').close(); }) } }); //set data for slimselect $(val.select).data('slimselect', val.var); }); /* * If filtering (from ftrindex hook), show loading in result box * */ function filter(active) { if (active) { var $counterbox = $('.counterbox'); $counterbox.empty(); $counterbox.append('