From 291c3a3ec5b95e20fb793c789410ae0bfb4b690c Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 21 Aug 2017 17:48:30 +0300 Subject: [PATCH] stop current animation first in animateElement() --- js/dom.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/dom.js b/js/dom.js index dbdcbae9..23d1a351 100644 --- a/js/dom.js +++ b/js/dom.js @@ -119,7 +119,12 @@ function animateElement( } resolve(); }); - element.classList.add(className); + if (element.classList.contains(className)) { + element.classList.remove(className); + setTimeout(() => element.classList.add(className)); + } else { + element.classList.add(className); + } }); }