Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong><a href="http://jsbin.com/acumo" rel="noreferrer">Working Example</a></strong> here - add <strong>/edit</strong> to the URL to play with the code</p> <p>You just need to use JavaScript <a href="https://developer.mozilla.org/En/Window.setInterval" rel="noreferrer"><code>setInterval</code></a> function</p> <pre><code>$('html').addClass('js'); $(function() { var timer = setInterval( showDiv, 5000); var counter = 0; function showDiv() { if (counter ==0) { counter++; return; } $('div','#container') .stop() .hide() .filter( function() { return this.id.match('div' + counter); }) .show('fast'); counter == 3? counter = 0 : counter++; } }); </code></pre> <p>and the HTML</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; &lt;title&gt;Sandbox&lt;/title&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt; &lt;style type="text/css" media="screen"&gt; body { background-color: #fff; font: 16px Helvetica, Arial; color: #000; } .display { width:300px; height:200px; border: 2px solid #000; } .js .display { display:none; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;Example of using setInterval to trigger display of Div&lt;/h2&gt; &lt;p&gt;The first div will display after 10 seconds...&lt;/p&gt; &lt;div id='container'&gt; &lt;div id='div1' class='display' style="background-color: red;"&gt; div1 &lt;/div&gt; &lt;div id='div2' class='display' style="background-color: green;"&gt; div2 &lt;/div&gt; &lt;div id='div3' class='display' style="background-color: blue;"&gt; div3 &lt;/div&gt; &lt;div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>EDIT:</strong></p> <p>In response to your comment about the container div, just modify this</p> <pre><code>$('div','#container') </code></pre> <p>to this</p> <pre><code>$('#div1, #div2, #div3') </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload