Add event listening for page transitions