MINI
C:
/
siak
/
app
/
dukcapil
/
Upload File:
files >> C:/siak/app/dukcapil/script.js
const modal=document.getElementById("loginModal"); const toast=document.getElementById("toast"); const menuBtn=document.getElementById("menuBtn"); const topbar=document.querySelector(".topbar"); document.querySelectorAll("[data-open-login]").forEach(btn=>btn.addEventListener("click",()=>{modal.classList.add("open");modal.setAttribute("aria-hidden","false");document.body.style.overflow="hidden"})); document.querySelectorAll("[data-close-login]").forEach(btn=>btn.addEventListener("click",()=>{modal.classList.remove("open");modal.setAttribute("aria-hidden","true");document.body.style.overflow=""})); document.addEventListener("keydown",e=>{if(e.key==="Escape"){modal.classList.remove("open");document.body.style.overflow=""}}); menuBtn.addEventListener("click",()=>topbar.classList.toggle("nav-open")); document.querySelectorAll("nav a").forEach(a=>a.addEventListener("click",()=>topbar.classList.remove("nav-open"))); document.getElementById("togglePass").addEventListener("click",e=>{ const input=document.getElementById("password"); input.type=input.type==="password"?"text":"password"; e.target.textContent=input.type==="password"?"Tampilkan":"Sembunyikan"; }); document.getElementById("demoLogin").addEventListener("click",()=>{ modal.classList.remove("open");document.body.style.overflow=""; toast.classList.add("show");setTimeout(()=>toast.classList.remove("show"),3200); }); const sections=[...document.querySelectorAll("main section[id]")]; const links=[...document.querySelectorAll("nav a")]; const observer=new IntersectionObserver(entries=>{ entries.forEach(entry=>{ if(entry.isIntersecting){ links.forEach(l=>l.classList.toggle("active",l.getAttribute("href")==="#"+entry.target.id)); } }); },{rootMargin:"-40% 0px -50% 0px"}); sections.forEach(s=>observer.observe(s)); document.querySelectorAll(".nav-dropdown > .nav-link").forEach(btn=>{ btn.addEventListener("click",()=>{ const parent=btn.parentElement; const isOpen=parent.classList.contains("open"); document.querySelectorAll(".nav-dropdown").forEach(x=>x.classList.remove("open")); if(!isOpen) parent.classList.add("open"); }); }); document.addEventListener("click",e=>{ if(!e.target.closest(".nav-dropdown")) document.querySelectorAll(".nav-dropdown").forEach(x=>x.classList.remove("open")); });
Copyright ©2021 || Defacer Indonesia