added horizontal scroll position detection