Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The reason its jumping to the top left before it resizes is because all the other <code>&lt;p&gt;</code>'s are getting their <code>display</code> set to <code>none</code>. The solution is to set the current <code>&lt;p&gt;</code> to absolute position before it resizes.</p> <p>try this!</p> <p>Wrap the HTML in a Div that has relative positioning:</p> <pre><code>&lt;div id='container' style="position: relative;"&gt; &lt;div id="row1" class="row-fluid"&gt; &lt;p id="p1" class="hero-unit span4 "&gt;P número 1&lt;/p&gt; &lt;p id="p2" class="hero-unit span4 "&gt;P número 2&lt;/p&gt; &lt;p id="p3" class="hero-unit span4 "&gt;P número 3&lt;/p&gt; &lt;/div&gt; &lt;div id="row2" class="row-fluid"&gt; &lt;p id="p4" class="hero-unit span4 "&gt;P número 4&lt;/p&gt; &lt;p id="p5" class="hero-unit span4 "&gt;P número 5&lt;/p&gt; &lt;p id="p6" class="hero-unit span4 "&gt;P número 6&lt;/p&gt; &lt;/div&gt; &lt;div id="row3" class="row-fluid"&gt; &lt;p id="p7" class="hero-unit span4 "&gt;P número 7&lt;/p&gt; &lt;p id="p8" class="hero-unit span4 "&gt;P número 8&lt;/p&gt; &lt;p id="p9" class="hero-unit span4 "&gt;P número 9&lt;/p&gt; &lt;/div&gt; &lt;/div&gt;​​​​​ $(document).ready(function(){ $("p").click(function(){ current = $(this); var position = current.position(); $("p").not(this).fadeOut(1000, function(){ // set the current position to absolute with the top and left dimensions the same; current.css({ 'postition' : 'absolute', 'left' : position.left, 'top' : position.top, }); current.animate({ margin: "0px", height: "420px", width: "940px" top: "0px", left: "0px" }, 1000, function(){ current.removeClass("span4"); }); }); }); });​ </code></pre> <p>Note that none of this requires jQuery.UI. it will work on plain jQuery :)</p> <p>And a here is a jsfiddle to show it in action: <a href="http://jsfiddle.net/Fgb9b/1/" rel="nofollow">http://jsfiddle.net/Fgb9b/1/</a></p> <p>Enjoy!</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