Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to slide out and slide in two divs alternately in single line?
    text
    copied!<p>I'm trying to do function to sliding new added content, using jQuery slide effect but I can't apply any solutions to put two divs in a single line. How to fix code below to slide from left to the right side by side? Maybe this code is completely to rebuild?</p> <p>jsFiddle: <a href="http://jsfiddle.net/2xuKz/2/" rel="nofollow">jsfiddle</a></p> <p>JS:</p> <pre><code>$(function() { $("#hello").html("Hello"); $('#edit').toggle(function() { var newhtml = '&lt;input type="text" id="hello_input" value="" /&gt;'; slideNewContent(newhtml); }, function() { var newhtml = $("#hello_input").val(); slideNewContent(newhtml); }); }); function slideNewContent(c) { $("#slideOut").empty(); $("#slideIn").children().clone().appendTo("#slideOut"); $("#slideIn").find("#hello").html(c); var slideOut = $("#slideOut"); var slideIn = $("#slideIn"); slideOutIn(slideOut, slideIn); } function slideOutIn(outElement, inElement) { var hideoptions = { "direction": "right", "mode": "hide" }; var showoptions = { "direction": "left", "mode": "show" }; $(outElement).effect("slide", hideoptions, 1000); $(inElement).effect("slide", showoptions, 1000); } </code></pre> <p>​HTML:</p> <pre><code>&lt;div class="span3"&gt; &lt;div id="slider"&gt; &lt;div id="slideIn" class="content"&gt; &lt;span&gt; &lt;span id="hello"&gt;&lt;/span&gt; &lt;button class="btn btn-mini" id="edit"&gt;Edit&lt;/button&gt; &lt;/span&gt; &lt;/div&gt; &lt;div id="slideOut" class="content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt;​ </code></pre> <p>CSS:</p> <pre><code>#slider { /*float:left;*/ display: inline-block; } #slideIn { width: 270px; /*display: inline;*/ } #slideOut { width: 270px; /*display: inline;*/ } #hello_input { width:160px; } </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