FadeIn and FadeOut with jQuery

I am having some trouble fading in and out my Submit button. The animation works as I want but with a minor issue.

When I enter in the form info, on my contact page, and hit Submit, the Submit button fades out and the success message fades in. This is correct except the fades on the Submit button doesn't seem to finish fading before display is set to none. It animates close to the end and then disappears before it finishes. This makes the animation look jerky.
I want the animation to be smooth all the way to the end.

Here is my site: www.skurat.com
Submit an email form and you will see what I am talking about.

Any help would be great.

Thanks,
Tony
LVL 8
askurat1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Where is the fadeout code rather than searching for it..?
I suspect you probably just need to cover it with a function

$('submitid').fadeOut('slow', function() {
    // add code to fade in success

});
0
askurat1Author Commented:
Here is the code:
var getName = $('#name').val(),
			    message = '<h5>Thanks, <b>' + getName + '</b>!</h5><h5>Your message has been sent.</h5>'			
			
            $('#submit, .sending').fadeOut(1600);

            $('.mess').delay(4000).html(message).fadeIn('fast', function () {
			   $('#form').clearForm();
			   $(this).delay(5000).fadeOut('slow', function() {         
                $('#submit').fadeIn('slow');
            });	
			});

Open in new window


I have already tried what you said and it doesn't seem to work.
This code can be found in custom.js.
0
GaryCommented:
Should the success be fading in as the submit fades out or waiting til the submit button is completely faded out?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

askurat1Author Commented:
It doesn't really matter. I just want the button to fade correctly.
0
GaryCommented:
http://jsfiddle.net/v7JB8/6/

The click event runs the function to fade out the Submit then fires the fade in.
Let me know if you need help adapting it.
0
askurat1Author Commented:
Not sure how this is different from what I have.
0
askurat1Author Commented:
Updated:
$('#submit, .sending').fadeOut('slow', function (){
				$('.mess').delay(1000).html(message).fadeIn('fast', function () {
			   $('#form').clearForm();
			   $(this).delay(5000).fadeOut('slow', function() {         
                $('#submit').fadeIn('slow');
            });	
			});				
			});

Open in new window


Still does the same thing.
0
GaryCommented:
I don't have time right now to rewrite your code but you need to encapsulate the order of things so they run after each other.
So in your ajax call set the sending to show, on successful call back hide the submit/sending and show the success message or an error message
0
askurat1Author Commented:
I'm still not understanding. To simplify things I have removed sending from showing.
$('#submit').fadeOut('slow', function (){
		$('.mess').delay(1000).html(message).fadeIn('fast', function () {
			   $('#form').clearForm();
			   $(this).delay(5000).fadeOut('slow', function() {         
                                   $('#submit').fadeIn('slow');
                           });	
		  });				
});

Open in new window


I'm not sure what I'm doing wrong.

Thanks for the help.
0
GaryCommented:
Does this work for you
http://jsfiddle.net/v7JB8/26/
0
askurat1Author Commented:
Thanks for the help but I did figure out the problem.

It was in my css for the Submit button:
-webkit-transition: all .3s ease; -moz-transition: all .3s ease; transition: all .3s ease;

Open in new window


As soon as I removed the transitions it worked. I still wanted the transitions so I have the whole contact form fading out instead of just the Submit button.

Thanks for the help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
askurat1Author Commented:
I found the solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.