Wait for the content to fadeIn a div with jquery ajax -
i have div, button.
- when press button
fadeout()
div - i load content page, jquery
ajax()
- when content loaded, want put content div
- 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'); }); },
Comments
Post a Comment