Jump to content

JQuery .remove() firing to fast


dzhax

Recommended Posts

Hey everyone!

 

I have the following code:

 

$('#notification').fadeOut(450).remove();

 

when this fires it is removing the element before it's done fading. is there something I am doing wrong? Also I even tried adding .delay(x) in between the fadeOut and remove.

Link to comment
Share on other sites

I'm no expert with jQuery, but you probably should remove the element with a callback function in the faceOut method.

$('#notification').fadeOut(450, "linear", function() { $('notification').remove() })
Link to comment
Share on other sites

Or try...

$('#notification').fadeOut( 450, remove );//or maybe$('#notification').fadeOut( 450, function(){$(this).remove();} );
Edited by davej
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...