Using the same animation on multiple elements
I am performing the same animation three different times on three different elements. Is there a more efficient way to do this?
Here's my code:
- $('.tier1').animate({opacity:.2}, 500)
- $('.tier2').animate({opacity:.2}, 500)
- $('.tier3').animate({opacity:.2}, 500)
- $('.tier4').animate({opacity:1}, 500)
I can't just give them all the same class name since the active tier changes to 100% opacity based on interaction and I'd have to do a removeClass and addClass which I imagine would be just as much code.
I would appreciate any help I can get.