dzhax Posted October 3, 2013 Share Posted October 3, 2013 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 More sharing options...
Ingolme Posted October 3, 2013 Share Posted October 3, 2013 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 More sharing options...
davej Posted October 3, 2013 Share Posted October 3, 2013 (edited) Or try... $('#notification').fadeOut( 450, remove );//or maybe$('#notification').fadeOut( 450, function(){$(this).remove();} ); Edited October 3, 2013 by davej Link to comment Share on other sites More sharing options...
dzhax Posted October 3, 2013 Author Share Posted October 3, 2013 adding the callback instead of adding it to the end did it. thanks a lot both of you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now