optimizes window scroll event with requestAnimationFrame