Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here i have done complete bins for above query. below is demo link, i think it may help you</p> <p><strong>Demo:</strong> <a href="http://codebins.com/bin/4ldqp9b/1" rel="nofollow noreferrer">http://codebins.com/bin/4ldqp9b/1</a></p> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="edge"&gt; &lt;div class="box" style="top:20; background:#f8a2a4;"&gt; &lt;/div&gt; &lt;div class="box" style="top:70; background:#a2f8a4;"&gt; &lt;/div&gt; &lt;div class="box" style="top:120; background:#5599fd;"&gt; &lt;/div&gt; &lt;/div&gt; &lt;br/&gt; &lt;input type="button" id="btnAnimate" name="btnAnimate" value="Animate" /&gt; </code></pre> <p><strong>CSS:</strong></p> <pre><code>body{ background:#ffffef; } #edge{ width:500px; height:200px; border:1px solid #3377af; padding:5px; } .box{ position:absolute; left:10; width:40px; height:40px; border:1px solid #a82244; } </code></pre> <p><strong>JQuery:</strong></p> <pre><code>$(function() { $("#btnAnimate").click(function() { var move = ""; if ($(".box:eq(0)").css('left') == "10px") { move = "+=" + ($("#edge").width() - 35); } else { move = "-=" + ($("#edge").width() - 35); } $(".box").animate({ left: move }, 500, function() { if ($(".box:eq(0)").css('left') == "475px") { $(this).css('background', '#afa799'); } else { $(".box:eq(0)").css('background', '#f8a2a4'); $(".box:eq(1)").css('background', '#a2f8a4'); $(".box:eq(2)").css('background', '#5599fd'); } }); }); }); </code></pre> <p><strong>Demo:</strong> <a href="http://codebins.com/bin/4ldqp9b/1" rel="nofollow noreferrer">http://codebins.com/bin/4ldqp9b/1</a></p>
 

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