This commit is contained in:
2025-08-11 16:38:01 +05:45
parent 8704a98f70
commit e7c1d50e9f
7 changed files with 345 additions and 0 deletions

27
bib-toaster/toaster.js Normal file
View File

@@ -0,0 +1,27 @@
document.addEventListener('DOMContentLoaded', () => {
const toast = document.getElementById('flashToast');
if (!toast) return;
// Show it
requestAnimationFrame(() => {
toast.classList.add('show');
});
// Close on [×]
toast.querySelector('.toast__close').addEventListener('click', () => {
hideToast();
});
// Auto-hide after 3s
const hideTimeout = setTimeout(hideToast, 3000);
function hideToast(){
clearTimeout(hideTimeout);
toast.classList.add('hide');
// Remove from DOM after transition
toast.addEventListener('transitionend', () => {
toast.remove();
}, { once: true });
}
});