$(function () { // Header Scroll $(window).scroll(function () { if ($(window).scrollTop() >= 60) { $("header").addClass("fixed-header"); } else { $("header").removeClass("fixed-header"); } }); // Tooltip const tooltipTriggerList = Array.from( document.querySelectorAll('[data-bs-toggle="tooltip"]') ); tooltipTriggerList.forEach((tooltipTriggerEl) => { new bootstrap.Tooltip(tooltipTriggerEl); }); // Count $('.count').each(function () { $(this).prop('Counter', 0).animate({ Counter: $(this).text() }, { duration: 1000, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now)); } }); }); // ScrollToTop function scrollToTop() { window.scrollTo({ top: 0, behavior: 'smooth' }); } const btn = document.getElementById("scrollToTopBtn"); if (btn) btn.addEventListener("click", scrollToTop); window.onscroll = function () { const btn = document.getElementById("scrollToTopBtn"); if (document.documentElement.scrollTop > 100 || document.body.scrollTop > 100) { btn.style.display = "flex"; } else { btn.style.display = "none"; } }; // Aos AOS.init({ once: true, }); // Scroll const sections = document.querySelectorAll("section[id]"); window.addEventListener("scroll", navHighlighter); function navHighlighter() { let scrollY = window.pageYOffset; sections.forEach(current => { const sectionHeight = current.offsetHeight; const sectionTop = current.offsetTop - 100; sectionId = current.getAttribute("id"); if ( scrollY > sectionTop && scrollY <= sectionTop + sectionHeight ) { document.querySelector(".navbar-collapse a[href*=" + sectionId + "]").classList.add("active"); } else { document.querySelector(".navbar-collapse a[href*=" + sectionId + "]").classList.remove("active"); } }); } });