{"id":23749695,"url":"https://github.com/frzi/interpolated-scrolling","last_synced_at":"2025-06-30T01:32:25.508Z","repository":{"id":101834223,"uuid":"233280381","full_name":"frzi/interpolated-scrolling","owner":"frzi","description":"Example of implementing smooth/interpolated scrolling.","archived":false,"fork":false,"pushed_at":"2020-01-11T19:36:45.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-27T11:49:31.865Z","etag":null,"topics":["javascript","scrolling","smooth","web"],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frzi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-11T18:45:31.000Z","updated_at":"2020-01-11T19:36:47.000Z","dependencies_parsed_at":"2023-04-07T18:47:31.559Z","dependency_job_id":null,"html_url":"https://github.com/frzi/interpolated-scrolling","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frzi/interpolated-scrolling","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frzi%2Finterpolated-scrolling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frzi%2Finterpolated-scrolling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frzi%2Finterpolated-scrolling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frzi%2Finterpolated-scrolling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frzi","download_url":"https://codeload.github.com/frzi/interpolated-scrolling/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frzi%2Finterpolated-scrolling/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262693203,"owners_count":23349691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","scrolling","smooth","web"],"created_at":"2024-12-31T15:38:37.393Z","updated_at":"2025-06-30T01:32:25.467Z","avatar_url":"https://github.com/frzi.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Interpolated scrolling\n\u003e Smooth scrolling on desktops\n\n## Demo\n[Try it out on your desktop](https://frzi.github.io/interpolated-scrolling).\n\n## About\nSmooth scrolling isn't a new concept on the web. Smooth scrolling is often applied (implemented) on a site make it look more, well, smooth. Often visually helping the page for scroll based effects like parallax background images. Or perhaps the site is simply one giant `\u003ccanvas\u003e` element and all the contents is rendered via WebGL.\n\nWhatever the case, smooth scrolling is usually done via an entirely custom made implementation. Where the Javascript listens to events like `mousewheel` and `key{down|pressed|up}` (for arrows) and performs all the scrolling via code.\n\nThe problem with this however is that basic functionality and – more importantly – user preferences are quickly overlooked or ignored. Some of these are:\n* **Middle mouse click scroll (aka auto-scrolling)**  \n  A feature most popular on Windows machines. The user can click the middle mouse button to initiate auto-scrolling and move the mouse up or down to change the scroll speed.\n* **Page up/Page down/Home/End**  \n  A personal pet peeve. These buttons tend to be entirely forgotten on sites using custom scrolling implementations. Showing no effect when pressed. :(\n* **Mouse wheel sensitivity**  \n  The user may have set their mouse wheel sensitivity/speed to a non-default value. For some users a single nudge on the wheel may scroll a few lines of text. For others it may scroll an entire screen worth! This goes for trackpads as well.\n* **`prefers-reduced-motion: reduce` (up for discussion)**  \n  Up for debate: some believe smooth scrolling should be disabled when the user has enabled *reduced motion*.\n\nThe code in this repository examines an implementation for smooth scrolling: interpolated scrolling. Using the scroll position of `window`, interpolating its changes and applies it to some element's `scrollTop`.\n\nThis of course comes with its own set of caveats:\n* **No scrolling when selecting**  \n  Going out of bounds when selecting text will not initiate automatic scrolling.\n* **Not suitable for mobile**  \n  Pretty self explanatory. Browsers on mobile devices already implement a form of smooth scrolling. Handling the speed and deceleration natively.\n* **May not work on high refresh rate monitors**  \n  This implementation depends on the `requestAnimationFrame` function. Some browsers may have this fixed at 60fps despite the user sporting a monitor with a higher refresh rate (looking at you, Safari).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrzi%2Finterpolated-scrolling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrzi%2Finterpolated-scrolling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrzi%2Finterpolated-scrolling/lists"}