window.onscroll = function () { scrollFunction(); scrollFunctionBTT(); // back to top button }; window.onload = function () { scrollFunction(); }; window.onload = () => { const myModal = new bootstrap.Modal('#closed'); myModal.show(); } function scrollFunction() { if (document.documentElement.scrollTop > 30) { document.getElementById("navbar").classList.add("top-nav-collapse"); } else if ( document.documentElement.scrollTop < 30 ) { document.getElementById("navbar").classList.remove("top-nav-collapse"); } } let elements = document.querySelectorAll(".nav-link:not(.dropdown-toggle)"); for (let i = 0; i < elements.length; i++) { elements[i].addEventListener("click", () => { document.querySelector(".offcanvas-collapse").classList.toggle("open"); }); } document.querySelector(".navbar-toggler").addEventListener("click", () => { document.querySelector(".offcanvas-collapse").classList.toggle("open"); }); var cardSlider = new Swiper('.card-slider', { autoplay: { delay: 5000, disableOnInteraction: false }, loop: true, navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' }, slidesPerView: 2, spaceBetween: 70, breakpoints: { // when window is <= 991px 991: { slidesPerView: 1 } } }); myButton = document.getElementById("myBtn"); function scrollFunctionBTT() { if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { myButton.style.display = "block"; } else { myButton.style.display = "none"; } } function topFunction() { document.body.scrollTop = 0; // for Safari document.documentElement.scrollTop = 0; // for Chrome, Firefox, IE and Opera }