I have an element with a transition
property defined. I animate it between two states by toggling a class.
However, in Edge (40.15063.674.0, EdgeHTML 15.15063), a transition is not animated (the state changes immediately instead) if a previous transition has not finished.
Here's a minimal snippet. Note that the square should never jump discontinuously.
const div = document.getElementById("div");
setInterval(() => {
div.classList.add("translate");
setTimeout(() => {
div.classList.remove("translate");
}, 500);
}, 2000);
#div {
transition: 1000ms;
width: 300px;
height: 300px;
background-color: red;
}
.translate {
transform: translate(200px, 0);
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div id="div">Test</div>
</body>
</html>
How can I work around this bug?
I tried setting transition-property
as suggested here, but it didn't help.