%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/devita.rezakurnia.com/X9KQ7MW2RT8PY4ND6LV3JH5CG8BF2ZM7QW4/scene5/
Upload File :
Create Path :
Current File : //home2/rezakur1/devita.rezakurnia.com/X9KQ7MW2RT8PY4ND6LV3JH5CG8BF2ZM7QW4/scene5/scene5.js

/* =========================
HEADER
========================= */

fetch('../components/header.html')
.then(response => response.text())
.then(data => {

    document.getElementById(
        'header-container'
    ).innerHTML = data;

});


/* =========================
ENTRY ANIMATION
========================= */

window.addEventListener(
    'load',
    ()=>{

        document.body.classList.add(
            'loaded'
        );

        const items =
        document.querySelectorAll(
            '.accordion-item'
        );

        items.forEach((item,index)=>{

            setTimeout(()=>{

                item.classList.add(
                    'show'
                );

            },300 + (index * 250));

        });

    }
);
/* =========================
ACCORDION
========================= */

const accordionHeaders =
document.querySelectorAll(
    '.accordion-header'
);

accordionHeaders.forEach(header=>{

    header.addEventListener(
        'click',
        ()=>{

            const currentItem =
            header.parentElement;

            const currentContent =
            currentItem.querySelector(
                '.accordion-content'
            );

            const currentIcon =
            header.querySelector(
                '.icon'
            );

            const isActive =
            currentItem.classList.contains(
                'active'
            );

            /* TUTUP SEMUA */

            document
            .querySelectorAll(
                '.accordion-item'
            )
            .forEach(item=>{

                item.classList.remove(
                    'active'
                );

                const content =
                item.querySelector(
                    '.accordion-content'
                );

                const icon =
                item.querySelector(
                    '.icon'
                );

                content.style.maxHeight =
                null;

                icon.textContent = '+';

            });

            /* JIKA BELUM AKTIF → BUKA */

            if(!isActive){

                currentItem.classList.add(
                    'active'
                );

                currentContent.style.maxHeight =
                currentContent.scrollHeight + 30+ 'px';

                currentIcon.textContent =
                '−';
            }

        }
    );

});
/* OPEN CPL DEFAULT */

window.addEventListener(
    'load',
    ()=>{

        const firstItem =
        document.querySelector(
            '.accordion-item.active'
        );

        if(firstItem){

            const content =
            firstItem.querySelector(
                '.accordion-content'
            );

            const icon =
            firstItem.querySelector(
                '.icon'
            );

            content.style.maxHeight =
            content.scrollHeight + 'px';

            icon.textContent = '−';
        }

    }
);

Zerion Mini Shell 1.0