js提示层效果,警告提示浮动窗口网页特效,一共就几行代码很简单。结合了少量的svg代码。const toasts = document.querySelectorAll(".toast"); const toastTriggers = document.querySelectorAll(".toast__trigger"); toastTriggers.forEach((trigger, index) => { let toastTimeout; trigger.addEventListener("click", () => { toasts[index].classList.add("toast--active"); toastTimeout = setTimeout(() => { toasts[index].classList.remove("toast--active"); }, 3500); }); toasts[index].addEventListener("click", () => { toasts[index].classList.remove("toast--active"); clearTimeout(toastTimeout); }); });
preview Points Download 6毛Download Share Download
未经允许不得转载: ICode联盟 » Plugin Special Effects » toast右下角提示层JavaScript代码