<script>
(function($) {
  $(document).on('facetwp-loaded', function() {
    if (FWP.loaded) {
      var is_selected = FWP.facets['category_group'].length > 0;
      $('.facetwp-template').toggleClass('visible', is_selected);
    }
  });
})(jQuery);
</script>