I have got so far with this but as I am relatively new to JavaScript have soon become quite stuck. I would like to randomly show a div that fades in, if visible for 5 seconds and then fades out. There should then be a 10 second delay before the next random div appears. Ideally no two divs should show back to back.
If possible could the delay between showing one then another be random between 10-20 seconds?
$(".demoBooked").fadeIn(2000).delay(5000).fadeOut(1000);
body {
padding: 50px;
}
.demoBooked {
background: GOLD;
padding: 20px;
border-radius: 3px;
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<p class="demoBooked">Demo 01</p>
<p class="demoBooked">Demo 02</p>
<p class="demoBooked">Demo 03</p>
<p class="demoBooked">Demo 04</p>
<p class="demoBooked">Demo 05</p>
<p class="demoBooked">Demo 06</p>
<p class="demoBooked">Demo 07</p>
<p class="demoBooked">Demo 08</p>
<p class="demoBooked">Demo 09</p>
<p class="demoBooked">Demo 10</p>