How do I show one of the divs sequentially when the page is refreshed? for example, div 1 will appear when the page is opened, and when the page is refreshed, div 2 will change to 3 - 4 -5 on the next refresh, and when the queue is finished, it will return to the beginning.
Example I'm working on:
$(document).ready(function() {
let divs = document.querySelectorAll(".category");
for (let index = 0; index < divs.length; index++) {
$(divs[index]).show()
}
});
.category {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<div class="category">1</div>
<div class="category">2</div>
<div class="category">3</div>
<div class="category">4</div>
<div class="category">5</div>
Here it shows all when the page is loaded. How can I solve this?