facetwp add expanded class to checkboxes

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

add_action( ‘wp_head’, function() { ?>
<script>
(function($) {
$(function() {
FWP.hooks.addAction(‘facetwp/loaded’, function() {
$(‘.facetwp-type-checkboxes .facetwp-depth.visible’).prev(‘.facetwp-checkbox’).toggleClass(‘expanded’);
}, 100 );
});
$(document).on(‘click’, ‘.facetwp-expand’, function() {
$(this).parent().toggleClass(‘expanded’);
});
})(jQuery);
</script>
<?php } );
{{/gist}}