converted to vanilla js on class changing to see if Apple device will like that.