I created the next code:
setTimeout(function () {
var dot = document.querySelectorAll('.dot');
for (var i=0;i<dot.length;i++) {
dot[i].style.backgroundColor = 'blue';
}
},2000);
.container{
display: flex;
justify-content: space-around;
}
.dot{
background-color: red;
width: 20px;
height: 20px;
border-radius: 50%;
}
<div class="container">
<div class="dot"></div>
<div class="dot" ></div>
<div class="dot" ></div>
</div>
This code apply background-color for each dot at the same time after 2 seconds, but i want to apply the style for each dot separately. Fo example: after 2 seconds to apply the style for first dot, then after 2 seconds to apply the style for second dot, and so on. Who has a solution?