I want to move the three dots consecutively
but do not move vertically, I managed to move them horizontally
I found what I want but with css link
can it be with javascript?
let rootElements = document.querySelectorAll("div.dot");
let i = 0;
setInterval(() => {
i++;
if (i % 10 > 2) {
i = 0;
}
rootElements[i % 10].style.margin = "0px";
for (let j = 0; j < rootElements.length; j++) {
if (j !== i) {
rootElements[j].style.margin = "-1px";
}
}
}, 500);
.dot {
display: inline-block;
margin: -1px;
}
<div>
<div class="dot">⚫</div>
<div class="dot">⚫</div>
<div class="dot">⚫</div>
</div>