Created
March 3, 2024 15:45
-
-
Save tdmrhn/51b091dbe5f717f5941f3806b51d8342 to your computer and use it in GitHub Desktop.
Blocksy 2 Close Woo Filters Panel when click on an filter item
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
<?php | |
add_action('wp_footer', function () { | |
?> | |
<script> | |
document.body.addEventListener('click', (event) => { | |
const panel = document.getElementById("woo-filters-panel"); | |
if (panel && event.target.closest('.ct-filter-item a')) { | |
event.preventDefault(); | |
const toggleClose = panel.querySelector('.ct-toggle-close'); | |
toggleClose && toggleClose.click(); | |
} | |
}); | |
</script> | |
<?php | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment