Skip to content

Instantly share code, notes, and snippets.

@kmgdevelopment
Created August 14, 2012 20:37
Show Gist options
  • Save kmgdevelopment/3352733 to your computer and use it in GitHub Desktop.
Save kmgdevelopment/3352733 to your computer and use it in GitHub Desktop.
Apply Effects to Ajax Function
$('a').click(function(e){
e.preventDefault();
var theUrl = $(this).attr('href');
$.ajax({
url: theUrl,
success: function(data){
var theTemplate = $(data);
$('.containerDiv').html(theTemplate);
}
});
});
@objectivehtml
Copy link

The fadeOut method is getting triggered, then immediately after, the fadeIn method is triggered. You need to use the fadeOut callback method so you trigger the fadeIn after the fadeOut is complete.

@kmgdevelopment
Copy link
Author

ah ok, that makes sense. The fadeIn starts after the previous event begins not ends. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment