switched to requestAnimationFrame to handle the refresh and avoid new layout each scroll event