var notificationMsg= document.getElementById("notificationMsg"); var notificationPoper= document.getElementById("notificationPop"); var notificationParent= document.getElementById("notificationParent"); var notificationLoader= document.getElementById("notificationLoader"); // var notificationFillAmount=100; var notificationTime=5000; // var smoothingFactor=1; $(document).ready(function () { notificationMsg= document.getElementById("notificationMsg"); notificationPoper= document.getElementById("notificationPop"); notificationParent= document.getElementById("notificationParent"); notificationLoader= document.getElementById("notificationLoader"); $("#notificationCTA").click(function () { deactivateNotification(); }); }); function notificationPop(msg){ if(!notificationMsg&&!notificationPoper) return; if(notificationPoper.classList.contains("activateNotification")){ notificationPoper?.classList.remove("activateNotificationPop"); notificationParent?.classList.remove("activateNotification"); notificationLoader?.classList.remove("activateNotificationLoader"); setTimeout(function(){ activateNotification(msg); },600); }else{ activateNotification(msg); } } function activateNotification(msg){ notificationMsg.innerHTML=msg; notificationLoader.style.setProperty('--notificationTime',notificationTime+"ms"); notificationPoper?.classList.add("activateNotificationPop"); notificationParent?.classList.add("activateNotification"); notificationLoader?.classList.add("activateNotificationLoader"); // notificationFillAmount=100; // notificationLoader.style.width=notificationFillAmount+"%"; // var notificationInterval= setTimeout(function(){ // notificationFillAmount-=smoothingFactor/(notificationTime); // if(notificationFillAmount<0){ // notificationFillAmount=0; //notificationLoader?.classList.remove("activateNotificationLoader"); deactivateNotification(); // clearInterval(notificationInterval); // } // notificationLoader.style.width=notificationFillAmount+"%"; },notificationTime); } function deactivateNotification(){ if(!notificationPoper) return; if(notificationPoper.classList.contains("activateNotificationPop")) notificationPoper.classList.remove("activateNotificationPop"); if(notificationParent.classList.contains("activateNotification")) notificationParent.classList.remove("activateNotification"); }