For better berformance add onscroll event to first div and call checkScroll on the onscroll event