Skip to content

Commit 6a9ed8c

Browse files
committed
fix ani
1 parent 0b5a4bc commit 6a9ed8c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎web_src/js/modules/toast.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ function showToast(message, level, {gravity, position, duration, useHtmlBody, pr
3333
const toastDupNumEl = toastEl.querySelector('.toast-duplicate-number');
3434
showElem(toastDupNumEl);
3535
toastDupNumEl.textContent = String(Number(toastDupNumEl.textContent) + 1);
36-
toastDupNumEl.classList.remove('pulse');
37-
requestAnimationFrame(() => toastDupNumEl.classList.add('pulse'));
36+
toastDupNumEl.classList.add('pulse');
37+
if (!toastDupNumEl.getAttribute('data-animation-event-attached')) {
38+
toastDupNumEl.addEventListener('animationend', () => toastDupNumEl.classList.remove('pulse'));
39+
toastDupNumEl.setAttribute('data-animation-event-attached', 'true');
40+
}
3841
return;
3942
}
4043
}

0 commit comments

Comments
 (0)