Created
July 23, 2018 17:17
-
-
Save djrmom/cba24c7debc94858bed98704a1a212b0 to your computer and use it in GitHub Desktop.
facetwp check specifc filters in use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment