The jQuery.animate method animates mostly numeric properties and does not cover the addition of a class subtraction.
If you just want to change the opacity, you can use . fadeTo .
$(".wrapper div").not(this).fadeTo('slow', 0.5);
The above will reduce the opacity by half.
This question contains additional information, including the jQueryUI switchClass method. This question also offers a plugin . AnimateToSelector .
Finally, there is animateToClass , but this apparently just transfers the .animate functions to the class, which means numerical values โโwill not work.
justkt Feb 22 2018-11-21T00: 00Z
source share