Switch jquery animations to css animations and transitions with js callback