Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Callback for jQuery.prepend() function

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..

Here is fiddle with my problem...

like image 858
simekadam Avatar asked Nov 13 '22 17:11

simekadam


1 Answers

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.

like image 132
Joe Avatar answered Nov 17 '22 05:11

Joe