
if (window.innerWidth <= 768) {
    window.addEventListener('click', function (event) {
        const navbarCollapse = document.getElementById('myNavbar');

        if (!event.target.matches('.navbar-toggler')) {
            navbarCollapse.classList.remove('in');
        }

    });

    // Close navbar when scrolling
    window.addEventListener('scroll', function () {
        const navbarCollapse = document.getElementById('myNavbar');

        navbarCollapse.classList.remove('in');

    });
}
