Added detection of css animation end using javascript