Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't animate rotation simultaneously with other properties, only in Safari (not Chrome)
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/9471038/safari-absolutely-positioned-divs-not-moving-when-updated-via-dom">Safari: Absolutely positioned DIVs not moving when updated via DOM</a> </p> </blockquote> <p><a href="https://stackoverflow.com/a/5463375/291022">This answer</a> to another question explains a small hack that lets you use jQuery to animate an element's rotation.</p> <p>In my situation, I wanted to animate an element's rotation simultaneously with its top: and left: properties. So I came up with <a href="http://jsfiddle.net/s5Bqa/4/" rel="nofollow noreferrer">this fiddle</a>.</p> <pre><code>function transformThing() { $('#thing').animate({ top: '+=50', left: '+=50', borderSpacing: -90 }, { step: function(now,fx) { if(fx.prop === 'borderSpacing') { $(this).css('-webkit-transform','rotate('+now+'deg)'); $(this).css('-moz-transform','rotate('+now+'deg)'); $(this).css('transform','rotate('+now+'deg)'); } }, duration: 1000 }, 'swing'); } $(document).ready(function() { $('#thing').click(function () { transformThing(); }); }); </code></pre> <p>Clicking the square <em>should</em> rotate it and move it down and to the right. And this is what it does, <em>except</em> in Safari. I'm running Safari 5.1.5 on Mac OS X 10.7.3, and only the rotation animates.</p> <p>A coworker found <a href="http://www.zachstronaut.com/posts/2009/08/07/jquery-animate-css-rotate-scale.html" rel="nofollow noreferrer">this jQuery plugin</a> that lets you do the same thing with cleaner syntax, but it exhibits the same problem.</p> <p>If you look in the Web Inspector, you can see the top: and left: values changing, and in fact they change to the correct values; but they don't affect the visual layout of the element unless you turn them off and on again.</p> <p>Clearly, the answer is "Um, duh, it's a Safari bug." But is there any deeper explanation that might help me find a workaround, or anything else I can try?</p>
    singulars
    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.
 

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