Note that there are some explanatory texts on larger screens.

plurals
  1. POFirefox behaves strangely when changing an element's position (CSS left, right, top, bottom) using jQuery.animate
    primarykey
    data
    text
    <p>Consider the following fiddle in Firefox: <a href="http://jsfiddle.net/rawKC/1/" rel="nofollow">http://jsfiddle.net/rawKC/1/</a></p> <p>Click the red rectangle and see how it moves. It disappears at once, then warbles out of nowhere somewhere at the top and comes to a stop at its proper end point. The expected behaviour (as can be seen in Chrome, for example) is to wander to its end point in a straight line, changing size as specified in the animate call.</p> <p>The rectangle is absolutely positioned using the left, right, top and bottom attributes. This is also how its size is determined. Upon clicking, the wrapper's positioning attributes are changed. I have no idea why the animation doesn't work in Firefox.</p> <p>I can think of a number of workarounds, but I would like to find out what's wrong with this particular use case. Does anybody have an idea?</p> <p><strong>EDIT</strong></p> <p>It seems like the containing element's styling is of no importance at all. Only the moving element behaves strangely. I've updated the question and fiddle accordingly.</p> <p><em>Code snippets for reference:</em></p> <pre class="lang-html prettyprint-override"><code>&lt;div id="wrapper"&gt;&lt;/div&gt; </code></pre> <pre class="lang-js prettyprint-override"><code>$(function() { var $wrapper = $('#wrapper'); $wrapper.click(function() { $wrapper.animate({ bottom: '85%', left: '2%', right: '75%', top: '2%' }); }); }); </code></pre> <pre class="lang-css prettyprint-override"><code>#wrapper { bottom: 35%; left: 18%; position: absolute; right: 18%; top: 35%; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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