Reputation: 333
I have a div, with a button.
fadeOut()
the divajax()
fadeIn()
the div.For now, I use this:
success: function (data) {
$('#inside-choice').html(data);
$('#inside-choice').fadeIn('slow');
},
But with this syntax, the fade in can start before that the content is totally loaded. How do I wait until the content is loaded before fading in the div?
Upvotes: 0
Views: 149
Reputation: 3393
use promise()
:
success: function (data) {
$('#inside-choice').html(data).promise().done(function(){
$('#inside-choice').fadeIn('slow');
});
},
https://api.jquery.com/promise/
Upvotes: 3