Forked from LesykJulia/collapse-and-expand-jet-smart-filters.php
Last active
March 3, 2023 10:20
-
-
Save Crocoblock/f5e383ce341e94904959b83c329497aa to your computer and use it in GitHub Desktop.
Make JetSmartFilters Expandable & Vice Versa https://crocoblock.com/troubleshooting/articles/making-jetsmartfilters-expandable/
This file contains hidden or 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
<style> | |
.jet-filter-label:after { | |
content: "˅"; | |
float: right; | |
margin-right: 10px; | |
} | |
.jet-filter-label.noicon:after{ | |
content: ""; | |
} | |
.jet-filter-label { | |
cursor: pointer; | |
} | |
.jet-filter-label.noicon { | |
cursor: pointer; | |
} | |
</style> | |
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
makeCollapsible(); | |
jQuery( document ).on( 'elementor/popup/show', function( event, id, instance ) { | |
if ( id ) { | |
makeCollapsible(); | |
} | |
} ); | |
}); | |
window.addEventListener( 'elementor/popup/show', function( event, id, instance ) { | |
if ( id ) { | |
makeCollapsible(); | |
} | |
}); | |
function makeCollapsible() { | |
jQuery(function($){ | |
$('.jet-checkboxes-list:not(.collapsible-applied)').slice(0).slideUp( | |
500, | |
function() { | |
$( this ).addClass( '.collapsible-applied' ); | |
$( this ).prev( '.jet-filter-label' ).click(function() { | |
$(this).next().slideToggle(); | |
if (!$(this).hasClass('noicon')){ | |
$(this).addClass('noicon'); | |
} | |
else { | |
$(this).removeClass('noicon'); | |
} | |
}); | |
} ); | |
}); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment