scrollTo function with x prediction and alignment