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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -