Detecting CSS Animation and Transition End with JavaScript