JSFiddle - React, Tailwind, and code Playground
HTML
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
CSS
div {
display: none;
width: 200px;
height: 30px;
background: red;
margin: 5px;
}
JavaScript
function show_item() {
const items = document.querySelectorAll('div');
const index = Math.floor(Math.random() * items.length);
const visible_items = [];
if(!visible_items.find(key => key === index)) {
items[index].style.display = 'block';
return;
}
show_item();
}
setInterval(() => {
show_item();
}, 3000);