# easy-elements/1.2.9/widgets/faq/js/faq.js

Easy Elements for Elementor – Addons &amp; Website Templates, version 1.2.9. 45 lines.

- Page: https://pluginprobe.com/plugins/easy-elements/1.2.9/code/widgets/faq/js/faq.js
- Raw: https://pluginprobe.com/plugins/easy-elements/1.2.9/raw/widgets/faq/js/faq.js
- Modified: 2026-01-06T13:07:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/easy-elements/1.2.9/code/widgets/faq/js/faq.js#L10-L20`.

```javascript
(function($) {
    "use strict";
    function handle_faq_($scope) {
        const $faqItems = $scope.find('.eel-faq-item');
        $faqItems.each(function () {
            const $item = $(this);
            const $question = $item.find('.eel-faq-question');
            const $answer = $item.find('.eel-faq-answer');
            $question.off('click.faqToggle');
            if ($item.hasClass('active')) {
                $answer.css('max-height', $answer[0].scrollHeight + 'px');
            } else {
                $answer.css('max-height', '0');
            }
            $question.on('click.faqToggle', function () {
                const isActive = $item.hasClass('active');
                $faqItems.removeClass('active')
                         .find('.eel-faq-answer')
                         .css('max-height', '0');

                if (!isActive) {
                    $item.addClass('active');
                    $answer.css('max-height', $answer[0].scrollHeight + 'px');
                }
            });
        });
    }

    function checkStickySection() {
        const stickySection = document.querySelector('.eel-faq-sticky');
        document.body.classList.toggle('sticky-enabled-overlap-faq', !!stickySection);
    }

    $(window).on('elementor/frontend/init', function () {
        elementorFrontend.hooks.addAction('frontend/element_ready/global', handle_faq_);
        elementorFrontend.hooks.addAction('frontend/element_ready/eel-faq-accordion.default', handle_faq_);

        checkStickySection();

        const observer = new MutationObserver(checkStickySection);
        observer.observe(document.body, { childList: true, subtree: true });
    });

})(jQuery);

```
