Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery add/remove Class with fadeIn/Out

Tags:

I would to apply a fadeIn effect to a addClass function..and fadeOut to removeClass...

Can you help me?

This is my code

$('#loader'+idTurno).addClass('loader'); 

...

$('#loader'+idTurno).removeClass('loader'); 
like image 793
Swim89 Avatar asked Mar 31 '13 16:03

Swim89


1 Answers

Fade In:

$("#loader").fadeIn("slow", function() {     $(this).addClass("loader"); }); 

Fade Out:

$("#loader").fadeOut("slow", function() {     $(this).removeClass("loader"); }); 

As another user said, you may want to look into using toggleClass.

like image 123
What have you tried Avatar answered Oct 25 '22 08:10

What have you tried