Note that there are some explanatory texts on larger screens.

plurals
  1. POSliding Div's removing 1st one from left and adding new from right
    text
    copied!<p>I have three div section horizontaly what i want is that after some time interval the left most div is removed and a new div is added from the right most direction</p> <p>this is the html file having 3 div sections within an outer div</p> <p><strong>HTML</strong> </p> <pre><code>&lt;div id="sub-category"&gt; &lt;div id="sub-category1"&gt; &lt;/div&gt; &lt;div id="sub-category2"&gt; &lt;/div&gt; &lt;div id="sub-category3"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>in the jquery a time interval of 5sec after every 5sec SlideDivSection(). Right now it removing the first div and shifting but it is not adding the new div to the right.</p> <p><strong>Jquery</strong> </p> <pre><code> function SlideDiv(){ setInterval(function(){SlideDivSection()}, 5000); } function SlideDivSection(){ $("#sub-category1").slideUp(); $("#sub-category1").remove(); $("#sub-category2").attr('id',"sub-category1");//setting the id of sub-cateogry2 to sub category1 $("#sub-category2").attr("id","sub-category2");//setting the id of sub-cateogry3 to sub category2 // now adding a new div $("#sub-cateogry").append("&lt;div id='#sub-cateogry3'&gt;&lt;/div&gt;"); //giving slidedown effect to newly created div $("#sub-cateogry3").slideUp(); } $("document").ready(SlideDiv); </code></pre> <p><strong>CSS</strong> </p> <pre><code>#sub-category { border:solid 0px black; width:686px; height:275px; position: relative; margin:5px; } #sub-category1 { border:solid 1px black; width:223px; height:293px; position: relative; float:left; background-color:grey; } #sub-category2 { border:solid 1px black; width:223px; height:293px; position: relative; margin-left: 5px; float:left; background-color:lightskyblue; } #sub-category3 { border:solid 1px black; width:222px; height:293px; position: relative; float:right; background-color:lightgreen; } </code></pre>
 

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