How to interrupt current CSS animation and start another?
I have the following example code which creates toasts that fly out from the top of the screen, stay for a few seconds, and then fly away: function createToast() { const elem = document.createElement("div"); elem.classList.add("toast"); elem.innerText = "hello"; document.body.appendChild(elem); setTimeout(()…