Optimized on scroll handling