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.

Share:
10,105

Related videos on Youtube

simekadam
Author by

simekadam

Android developer at Avast Mobile.

Updated on June 05, 2022

Comments

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

    Here is fiddle with my problem...

  • simekadam
    simekadam over 12 years
    I added link where you can see exactly my problem
  • simekadam
    simekadam over 12 years
    Yeah. thats working, but I was trying to achieve same thing with CSS transitions because of it's hardware acceleration on the iPad..
  • simekadam
    simekadam over 12 years
    Thanks..and as I am asking, whats the default value of setTimeout second parameter? 0ms?
  • Joe
    Joe over 12 years
    10ms is kind of the default. Basically if setTimeout is less than 10ms, the delay becomes 10ms