Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Probably this might help</p> <p>The code below moves a dot within the specified borders. Please see : that by adjust the width and height of the same dot you may have a snake like creature Have a look at the <a href="http://jsfiddle.net/J3PB8/2/" rel="nofollow">Fiddle</a></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; #midDiv{ float:left; width: 100px; height: 100px; background:rgb(0,0,0); } #topDiv,#bottomDiv{ float:left; width: 110px; height:5px; background: red; position:relative; } #leftDiv, #rightDiv{ width:5px; float:left; height: 100px; background: blue; position:relative; } #bodyWrapper{ width: 120px; height: 120px; } #centerDiv{ float:left; } .animateObject{ z-index:2; background: white; } &lt;/style&gt; &lt;script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#topDiv").on("animcomplete", function(){ $(".animateObject").remove(); var div = document.createElement("div"); $(div).width(5).height(5); div.className = "animateObject"; $("#rightDiv").append(div); $(div).css({position: "absolute"}); $(div).animate({ top: 100 }, 2000, function(){ $("#rightDiv").trigger({type: "animcomplete", time: new Date() }); }); }); $("#rightDiv").on("animcomplete", function(){ $(".animateObject").remove(); var div = document.createElement("div"); $(div).width(5).height(5); div.className = "animateObject"; $("#bottomDiv").append(div); $(div).css({position: "absolute", right: 0}); $(div).animate({ right: 100 }, 2000, function(){ $("#bottomDiv").trigger({type: "animcomplete", time: new Date() }); }); }); $("#bottomDiv").on("animcomplete", function(){ $(".animateObject").remove(); var div = document.createElement("div"); $(div).width(5).height(5); div.className = "animateObject"; $("#leftDiv").append(div); $(div).css({position: "absolute", bottom: -5}); $(div).animate({ bottom: 100 }, 2000, function(){ $("#leftDiv").trigger({type: "animcomplete", time: new Date() }); }); }); $("#leftDiv").on("animcomplete", function(){ $(".animateObject").remove(); var div = document.createElement("div"); $(div).width(5).height(5); div.className = "animateObject"; $("#topDiv").append(div); $(div).css({position: "absolute", left: 0}); $(div).animate({ left: 105 }, 2000, function(){ $("#topDiv").trigger({type: "animcomplete", time: new Date() }); }); }); $("#topDiv").trigger({type: "animcomplete", time: new Date() }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="bodyWrapper"&gt; &lt;div id="topDiv"&gt;&lt;/div&gt; &lt;div id="centerDiv"&gt; &lt;div id="leftDiv"&gt;&lt;/div&gt; &lt;div id="midDiv"&gt;&lt;/div&gt; &lt;div id="rightDiv"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="bottomDiv"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p></p> <p>This moves a dot within the specified borders. Please see : that by adjust the width and height of the same dot you may have a snake like creature</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