Use transitionEnd variable instead of function