Hello

function toggle_section_with_toggle_button(){
?>
<script>
window.addEventListener("DOMContentLoaded", function () { 
  (function($) {
    $('.avia-button-wrap.toggle-button a').addClass('no-scroll');
    $('.avia-button-wrap.toggle-button a').each(function() {
        // Save the original text of the button by addressing only the title span.
        $(this).data('original-text', $(this).find('.avia_iconbox_title').text());
        
        var targetSectionId = $(this).attr('href');
        $(targetSectionId).hide();
        $(targetSectionId).css('min-height', '0');
    });

    // Attach click event directly to the link tag.
    $('.avia-button-wrap.toggle-button a').on('click', function(e) {
        
        e.preventDefault();
        $(this).blur();
        
        var $button = $(this);
        var targetSectionId = $button.attr('href');
        var $targetSection = $(targetSectionId);
        
        if ($targetSection.length) {
            
            // Toggle the section with a callback function
            $targetSection.slideToggle(900, function() {
                
                // This code is executed when the animation is finished.
                if ($(this).is(':visible')) {
                    $button.find('.avia_iconbox_title').text('hide Section');
                } else {
                    $button.find('.avia_iconbox_title').text($button.data('original-text'));
                }
            });
        }
    });
  })(jQuery);
});
</script>
<?php
}
add_action('wp_footer', 'toggle_section_with_toggle_button');
webers-web.info