Callback for jQuery.prepend() function
10,105
Here's an update: http://jsfiddle.net/8MFJQ/4/
prepend doesn't have a callback because the DOM is ready with the call. I'm using Jquery's fadeIn and fadeOut as well to achieve wider browser coverage.
Related videos on Youtube
Comments
-
simekadam almost 2 years
is possible to add callback into prepend method? I need to wait until DOM is rebuild and then start fade animation.
$("body").prepend(div); $(div).css({ 'opacity': 1 });
The animation is made with CSS3 transitions, so I only need to wait for DOM ready and then change the CSS opacity..
-
simekadam over 12 yearsI added link where you can see exactly my problem
-
simekadam over 12 yearsYeah. thats working, but I was trying to achieve same thing with CSS transitions because of it's hardware acceleration on the iPad..
-
simekadam over 12 yearsThanks..and as I am asking, whats the default value of setTimeout second parameter? 0ms?
-
Joe over 12 years10ms is kind of the default. Basically if setTimeout is less than 10ms, the delay becomes 10ms