Hello,
On my recipe site, I have several sections with an accordion for each section. How can I have only one toggle open at a time for the whole accordion group? That is, if the user opens a toggle in one accordion, any toggle open in another accordion is closed.
Thanks!
Serge
try in your child-theme functions.php:
function ava_custom_toggle_behavior(){
?>
<script type="text/javascript">
(function($) {
$(window).on('load', function() {
$('.toggler').on('click', function() {
var $current = $(this);
// Short delay so Enfold can set its own classes
setTimeout(function() {
if ($current.hasClass('activeTitle')) {
// Find all other togglers on the page that are active
$('.toggler').not($current).each(function() {
if ($(this).hasClass('activeTitle')) {
// Simulate click or remove classes manually
$(this).trigger('click');
}
});
}
}, 100);
});
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'ava_custom_toggle_behavior');
