FacetWP – turn hierarchical checkbox facet into an accordion

mgibbs189

{{gist file=”test.js” lang=”javascript”}}
<script>
(function($) {
$(document).on(‘facetwp-loaded’, function() {
$(‘.facetwp-depth’).hide();
$(‘.facetwp-checkbox.checked’).each(function() {
$(this).parents(‘.facetwp-depth’).show();
$(this).next(‘.facetwp-depth’).show();
});
});
})(jQuery);
</script>
{{/gist}}