I have an image element, on which I want to apply two animation classes, one on the arrival and one on some fixed time.
For Example, on arrival i want a fadeIn effect. So i do this:
img.classList.add("wow");
img.classList.add("fadeIn");
I again want to add a heartbeat effect on the same image after some time. So i tried something like this:
setTimeout(function () {
img.classList.remove("fadeIn");
img.classList.add("heartBeat");
},3000);
This is not working, and the hearbeat effect is not seen.
Note:
On the other hand, if I don't initially set up the fadeIn effect to the image, then the image does take the heartbeat effect after 3000ms.
So a standalone code like this one, is working perfectly fine.
setTimeout(function () {
img.classList.add("heartBeat");
},3000);
I am not being able to figure out the cause of this problem.