javascript - show and hide divs on timer -


i have list of divs

<div id="container_dc">     <div class="slide" id="slide_1"></div>     <div class="slide" id="slide_2"></div>     <div class="slide" id="slide_3"></div>     <div class="slide" id="slide_4"></div> </div> 

each div has background image.

i want show , 1 div @ time starting first, , show each 4 second before hiding , showing next.

i cannot use jquery!

want simple possible.

what best way go this? code appreciated..

something along these lines:

var container = document.getelementbyid("container_dc"),     children = container.childnodes,     show=-1;  window.setinterval(function() {     if(children[show]) children[show].display='hidden';     show=show+1;     if(show==children.length) show=0;     children[show].display='block';     next=(next+1); },4000); 

the code documentation enough.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -