Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is quite easy to do using jQuery. Here is an example with one container. However, you can add as many as you wish. They will be working simultaneously. Sliding will start on mouse click.</p> <p>HTML Part:</p> <pre><code>&lt;div class="container"&gt; &lt;div class="slide active" style="background:red;"&gt;Slide 1&lt;/div&gt; &lt;div class="slide" style="background:yellow;"&gt;Slide 2&lt;/div&gt; &lt;div class="slide" style="background:green;"&gt;Slide 3&lt;/div&gt; &lt;div class="slide" style="background:blue;"&gt;Slide 4&lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS Part:</p> <pre><code>.container {position:relative; width: 400px; height: 200px;} .slide {position:absolute; left:0px; top:0px; width: 100%; height: 100%; line-height:200px; text-align:center; display:none;} .slide.active {display:block;} </code></pre> <p>JS Part:</p> <pre><code>jQuery('.container').bind('click', function(){ var container = jQuery(this), slides = container.children('.slide'); var current = container.children('.slide.active'); var currentID = slides.index(current); var nextID = currentID &lt; slides.length - 1 ? currentID + 1 : 0; var next = jQuery(slides[nextID]); if (jQuery('.container .active').length == 2) return; next.addClass('active'); next.css('opacity', 0); current.animate({ left: -container.width(), opacity: 0 }, 1000, function(){ current.removeClass('active'); current.css({left: 0, opacity: 1}); }); next.animate({ opacity: 1 }, 1000); }); </code></pre> <p>Here is the example on jsfiddle.net - <a href="http://jsfiddle.net/qe4Tt/" rel="nofollow">http://jsfiddle.net/qe4Tt/</a></p>
    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. This table or related slice is empty.
    1. This table or related slice is empty.
    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