modified to add a class instead of setting explicit css property during animation