October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Throttle Scroll Work for Smoother Web Interfaces

Throttling limits how often expensive scroll-dependent work runs. Learn how a timeout differs from requestAnimationFrame, IntersectionObserver, and scroll-driven CSS timelines.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Throttling can make a scroll interaction smoother when JavaScript is doing expensive work too often. It does not speed up the browser’s scrolling itself: it limits how often your follow-up code runs, so the handler does less unnecessary work while still responding to scroll position.

What scroll throttling does—and what it does not

The browser handles scrolling, but JavaScript scroll listeners can run frequently while the page moves. If a handler repeatedly performs costly calculations or changes the DOM, that work competes for the main thread and may contribute to a sluggish interface. Avoid work that is not needed for each event; throttle the remaining work if it still causes jank. MDN’s Document: scroll event guidance recommends this distinction.

As an Amazon Associate I earn from qualifying purchases.

A throttle limits how often a task may run while events continue to arrive. It is useful when a calculation must use current scroll position but does not need to run for every delivered event. It is not a guarantee of a particular speed increase, and it cannot fix unrelated rendering or layout bottlenecks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to throttle a scroll handler with a timeout

One straightforward pattern is to let only one timeout be pending at a time. Each scroll event can update the latest position; when the timeout runs, the code processes that position and opens the gate for another timeout. The interval below is an example to tune and measure—not a universal best setting. MDN’s example uses 20 milliseconds as an illustration.

#1 Best Overall
Sale
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)
let scheduled = false;
let latestScrollY = window.scrollY;

window.addEventListener("scroll", () => {
  latestScrollY = window.scrollY;

  if (scheduled) return;
  scheduled = true;

  setTimeout(() => {
    scheduled = false;
    updateFromScrollPosition(latestScrollY);
  }, 20);
});

function updateFromScrollPosition(scrollY) {
  // Put the necessary scroll-dependent work here.
}

Choose an interval based on how responsive the interaction needs to feel and whether measurements show that reducing the work helps. Keep the handler and the follow-up task lean: avoid repeated DOM modifications and unnecessary read/write layout cycles. A timeout limits how often this task runs; it does not ensure that the task itself is inexpensive.

Does requestAnimationFrame throttle scroll events?

No. requestAnimationFrame() schedules a callback before a repaint, but it is not a time-based scroll throttle. MDN states: “Note that you may see code that throttles the scroll event handler using requestAnimationFrame(). This is useless because animation frame callbacks are fired at the same rate as scroll event handlers.” See MDN’s scroll event article.

Rank #2
Sale
Logitech G305 Lightspeed Wireless Gaming Mouse - Black
  • The next-generation optical HERO sensor delivers incredible performance and up to 10x the power efficiency over previous generations, with 400 IPS precision and up to 12,000 DPI sensitivity
  • Ultra-fast LIGHTSPEED wireless technology gives you a lag-free gaming experience, delivering incredible responsiveness and reliability with 1 ms report rate for competition-level performance
  • G305 wireless mouse boasts an incredible 250 hours of continuous gameplay on just 1 AA battery; switch to Endurance mode via Logitech G HUB software and extend battery life up to 9 months
  • Wireless does not have to mean heavy, G305 lightweight mouse provides high maneuverability coming in at only 3.4 oz thanks to efficient lightweight mechanical design and ultra-efficient battery usage
  • The durable, compact design with built-in nano receiver storage makes G305 not just a great portable desktop mouse, but also a great laptop travel companion, use with a gaming laptop and play anywhere

Use requestAnimationFrame() when visual work should be coordinated with repaint, such as updating an animation. It is one-shot: an animation that needs more frames must request them again. Base animation progress on the callback timestamp rather than assuming every frame takes the same time. Callbacks are generally aligned to the display refresh rate and are paused in most browsers for background tabs or hidden iframes, as described in MDN’s Window: requestAnimationFrame() method.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the technique that matches the job

Approach What triggers work Best fit
Timeout throttle An elapsed-time interval Scroll-dependent calculations that must update during scrolling, but not on every event.
requestAnimationFrame() A scheduled repaint Visual updates that should be coordinated with the next frame; it does not reduce scroll-handler frequency by itself.
IntersectionObserver An element crossing an observation threshold Work that should begin or change when an element enters or intersects a scrolling area, rather than continuous position polling.
CSS scroll-driven timelines Scroll progress or an element’s progress through its scroller Animations whose progress should follow scrolling, when browser support and the animated properties meet the project’s needs.

For threshold-based visibility, MDN recommends considering IntersectionObserver instead of repeatedly checking position in a scroll handler. For declarative scroll-linked animations, Chrome for Developers explains Scroll-driven animations, including scroll and view progress timelines. Check support against the browsers, devices, and animation properties you actually need; support is not a substitute for testing the intended effect.

Rank #3
Sale
Logitech M185 Compact Ambidextrous Wireless Mouse with Rubber Grips - Blue
  • Compact Mouse: With a comfortable and contoured shape, this Logitech ambidextrous wireless mouse feels great in either right or left hand and is far superior to a touchpad
  • Durable and Reliable: This USB wireless mouse features a line-by-line scroll wheel, up to 1 year of battery life (2) thanks to a smart sleep mode function, and comes with the included AA battery
  • Universal Compatibility: Your Logitech mouse works with your Windows PC, Mac, or laptop, so no matter what type of computer you own today or buy tomorrow your mouse will be compatible
  • Plug and Play Simplicity: Just plug in the tiny nano USB receiver and start working in seconds with a strong, reliable connection to your wireless computer mouse up to 33 feet / 10 m (5)
  • Better than touchpad: Get more done by adding M185 to your laptop; according to a recent study, laptop users who chose this mouse over a touchpad were 50% more productive (3) and worked 30% faster (4)

How passive listeners fit in

A passive listener promises not to cancel the event’s default action. This can let the browser proceed without waiting for a cancelable wheel or touch listener. It does not make expensive JavaScript cheap, and MDN notes that passive status is not a concern for the basic scroll event. See EventTarget.addEventListener() for listener options.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Measure the result, not the technique

A common animation target is 60 frames per second, or about 16.7 milliseconds per frame. MDN presents that as guidance, not a guarantee: scripting, layout, and paint share the frame budget, and actual performance varies by device and workload. Its Recommended Web Performance Timings discussion notes that only part of that time may be available for scripting and other work.

Rank #4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
  • Computer mouse for easily navigating a computer interface; click, scroll, and more
  • USB-A wired connection; if existing device only supports USB-C, an additional adapter will be required
  • High-definition (1000 dpi) optical tracking ensures responsive cursor control for precise tracking and easy text selection
  • 3 buttons offer effortless fingertip control
  • Plug-and-go ready for instant use

Compare behavior before and after changing the handler on the devices and browsers that matter. Check whether the interaction remains responsive, whether the intended work still occurs at the right time, and whether the expensive work was actually reduced. If the task only needs to happen after scrolling finishes, consider the scrollend event, but verify its support for your target browsers before relying on it; MDN identifies the event in its scroll-event guidance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

SaleBestseller No. 1
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Logitech M185 Compact Ambidextrous 2.4 GHz Wireless Mouse - Swift Grey
Product carbon footprint: 3.97 kg CO2e; Contoured shape: Gives you more comfort and control
$14.85
SaleBestseller No. 3
Bestseller No. 4
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Amazon Basics 3-Button USB Wired Mouse with Responsive Tracking, Plug & Play, Compatible with Windows and Mac, Black
Computer mouse for easily navigating a computer interface; click, scroll, and more; 3 buttons offer effortless fingertip control
$9.70
Best Value
Sale
Acer Wireless Mouse for Laptop, 2.4GHz Computer Mouse 3 Adjustable 1600 DPI
  • 【Plug and Play for Home/Office/School】The wireless computer mouse features 2.4GHz connectivity, delivering a stable, interference-free connection up to 32ft. Designed for 𝐦𝐞𝐝𝐢𝐮𝐦 𝐭𝐨 𝐥𝐚𝐫𝐠𝐞 𝐬𝐢𝐳𝐞𝐝 𝐡𝐚𝐧𝐝𝐬, it ensures comfortable use all day. Simply plug in the USB-A receiver for instant pairing—no drivers needed. 📌📌 If the mouse isn’t suitable, place the USB receiver in the battery compartment and return both.
  • 【3 Levels Adjustable DPI】This travel USB mouse offers 3 adjustable DPI settings (800, 1200, 1600), allowing you to customize sensitivity for precise design work. Effortlessly switch to match your task and elevate your productivity. 📌 Please remove the film at the bottom of the mouse before use.
  • 【Effortless Browsing】Equipped with forward and backward buttons, this computer mice streamlines your workflow, making it easy to navigate through web pages and files with a simple click. 📌Side button does not work on Mac.
  • 【Visible Indicator Light】 The pc mouse features a visual indicator for DPI levels and low battery alerts. The red light flashes once for 800 DPI, twice for 1200 DPI, and three times for 1600 DPI. When the battery level is below 10%, the light flashes red until the mouse is completely out of power.
  • 【Click to Wake】With smart sleep mode, it saves power by standby after 10 inactive minutes, just 2-3 clicks to wake. This efficient design delivers 3x longer battery life than motion-wake mice. Engineered for durability, its buttons and scroll wheel are tested for 10 million clicks, ensuring long-term reliability and consistent performance.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.