Wait for the content to fadeIn a div with jquery ajax -


i have div, button.

  1. when press button fadeout() div
  2. i load content page, jquery ajax()
  3. when content loaded, want put content div
  4. only then, fadein() div.

for now, use this:

success: function (data) {      $('#inside-choice').html(data);      $('#inside-choice').fadein('slow'); }, 

but syntax, fade in can start before content totally loaded. how wait until content loaded before fading in div?

use promise() :

success: function (data) {      $('#inside-choice').html(data).promise().done(function(){        $('#inside-choice').fadein('slow');      });  }, 

https://api.jquery.com/promise/


Comments

Popular posts from this blog

shared memory - gstreamer shmsrc and shmsink with h264 data -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -

c++ - CPP, 'X' button listener -