I add an element to the DOM with a left position off the screen and then immediately afterwards set the left position to being on screen so it can do a transition animation, but this doesnt seem to work without a setTimeOut function.
but strangely when I do the same but with the element having a width of 0px first and then setting it to full width straight after I dont need the SetTimeOut.
Can anyone explain why this is?
It depends on whether the element was already rendered or not. Changing a position value immediately after setting it probably won't make it to the rendering sequence. You'll have to give it some time to get rendered before you can change it if you want CSS animations to take place. That's why you need to use
I'm not sure why this does work with element size, though. Seeing the code might help.