Simon Fraser wrote:
> Code like this won't trigger transitions for any property. The reason
> for this is that
> the browser batches style changes made in the same JavaScript cycle,
> so the
> es.left = "10px" simply overrides the earlier es.left = "0px".
>
> To make a transition happen here, you need to assign the final style
> in a setTimeout:
>
> style.left = "0px"
> style.webkitTransition = "left 100ms";
> window.setTimeout(function() {
> style.left = "100px";
> }, 0);
>
>
Thanks, Simon. I wish I had a dollar for every hour I spent figuring
this out. ;) (I might be able to buy myself a hamburger.)
You can see this behavior in iui.js version 0.30 in the slide2()
function, the line:
setTimeout(startTrans, 0);
was necessary to allow the browser to apply the previous changes
necessary to setup the transition.
iui.js would be an even better learning tool if it had comments :(
(Release 0.50?)
Is this documented somewhere? It would be cool if there were a way to
"flush' these operations without using setTimeout.
-- Sean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---