fixed transition bug and added scroll event listener