facetwp check specifc filters in use

djrmom

{{gist file=”script.js” lang=”javascript”}}
(function($) {
$(document).on(‘facetwp-loaded’, function() {
var facets_in_use = function() {
var in_use = false;
var checking = [“who”, “what”, “where”, “when”];
$.each(FWP.facets, function(name, val) {
if (0 < val.length && $.inArray( name, checking ) > -1) {
in_use = true;
return false; // exit loop
}
});
return in_use;
}
if ( facets_in_use() ) {
$( ‘.filter-trip-style’ ).addClass(‘in-use’);
} else {
$( ‘.filter-trip-style’ ).removeClass(‘in-use’);
}
});
})(jQuery);
{{/gist}}