Javascript wait until dom is updated. See question on StackOverflow. In order to get an animation to work, I am t...