Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I fade in element only AFTER content fades out jQuery with jQuery?

http://amyyatsuk.com/contact.html

I have an HTML form that uses jQuery ajax() to submit to a php processing page. In the success function of the ajax() call I have the following:

success: function() {
    $('#contactForm').fadeOut(1000);
    $('#hidden').delay(.1000).fadeIn(1500); 
    return false;

These effects are simultaneous. I'm looking to fade in the hidden div only after the contact form is fully faded out.

Thanks

like image 390
Roy Avatar asked Dec 27 '22 08:12

Roy


1 Answers

The fadeOut and fadeIn effects contain an onComplete callback (optional):

$('#contactForm').fadeOut(1000, function(){
  $('#hidden').fadeIn(1500); 
});
like image 128
Richard Parnaby-King Avatar answered Feb 06 '23 10:02

Richard Parnaby-King