Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dislokacia/76ff0da45b274e9ec258a366fa03ed83 to your computer and use it in GitHub Desktop.
Save dislokacia/76ff0da45b274e9ec258a366fa03ed83 to your computer and use it in GitHub Desktop.
JetSmartFilters indexer doesn't hide the margins from empty columns
jQuery(document).ready(function( $ ){
//on page load remove margins for the hidden filters
$( '.jet-filter:hidden').closest('.elementor-element').addClass('hide_margin');
//on applying the filters add the class to the hidden filters to remove the margins
$( document ).on( 'jet-filter-content-rendered', function() {
setTimeout(function() {
$( '.jet-filter:hidden').closest('.elementor-element').addClass('hide_margin');
}, 100);
});
//to remove the class when disable or check another filter
$( document ).on( 'change', function() {
$( '.elementor-element' ).removeClass('hide_margin');
});
});
/*css*/
.hide_margin {
margin-bottom: 0!important;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment