Add enddetection event dispatch on scroll end, shift handler logic to index markup