开发者

Callback for jQuery.prepend() function

is possible to add callback into prepend method? I need to wait until DOM is rebuild and the开发者_如何学JAVAn 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...


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.


If I'm not wrong you can do it like that $("body").append(div).css({'opacity': 1});. Or maybe you've to change the method for, like this $(div).appendTo('body').css({'opacity': 1});

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜