I am working on a landing page. I have 3 article elements, each of them has the property “display: none” and a class ‘art’. I want to display each of them while looping over them. They should appear successively: the previous ones must disappear at each iteration, that is why I have used var j
in the code below But JS code displays them after the whole process of looping is completed. How to deal with it? Here: https://codepen.io/user_jacob/pen/oNjqWGg. Currently, I am doing it like this (which is not working):
function makeAppear() {
var j = list.length-1;
for (var i = 0; i < list.length; i++) {
list[i].style.setProperty('display', 'block');
list[j-1].style.setProperty('display', 'none');
}
}