added a scroll listener to detect when get near the end