Change animation from css to js