explaingit

ustbhuangyi/better-scroll

Analysis updated 2026-06-24

16,487TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

JavaScript scrolling library that fixes janky mobile scrolling. Drop-in engine with plugins for pull-to-refresh, infinite scroll, and zoom on any wrapper element.

Mindmap

mindmap
  root((better-scroll))
    Inputs
      Wrapper element
      Touch and wheel events
      Plugin config
    Outputs
      Smooth scroll motion
      Pull to refresh event
      Infinite scroll callback
    Use Cases
      Smooth mobile scroll lists
      Build a picker carousel
      Add infinite scroll feed
    Tech Stack
      TypeScript
      JavaScript
      npm
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Make a long list scroll smoothly inside a fixed area on mobile

USE CASE 2

Add pull to refresh to a web feed

USE CASE 3

Build an infinite scroll list that loads more items near the bottom

USE CASE 4

Create a picker or carousel with snap and momentum

What is it built with?

TypeScriptJavaScriptnpm

How does it compare?

ustbhuangyi/better-scrollmayooear/ai-pdf-chatbot-langchaintremorlabs/tremor-npm
Stars16,48716,50316,471
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderateeasy
Complexity2/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

better-scroll is a JavaScript library that provides smooth, customizable scrolling behavior for web pages, particularly on mobile devices. Standard browser scrolling can feel sluggish or behave inconsistently on mobile, and better-scroll solves this by implementing its own scroll engine that gives developers fine-grained control over how content scrolls. It is inspired by iscroll (an earlier library with the same goal) and extends it with additional features and better performance. The core concept is simple: you have a fixed-height outer container (the "wrapper") and inner content that is taller than that container. better-scroll detects the overflow and handles touch events, momentum, and animations to make scrolling feel natural. The README walks through the basic setup with HTML and JavaScript examples, you point better-scroll at the outer wrapper element, and it takes over scrolling for the first child element inside it. From there, you can add plugins for specific behaviors: pull-to-refresh, infinite scroll (loading more items as the user approaches the bottom), zoom, and more. The library is written in TypeScript, has no dependencies (no framework required), and can be used with plain JavaScript or alongside UI frameworks. It supports both mobile and desktop browsers. It is installed via npm (npm install better-scroll) or loaded from a CDN for simpler setups. A lightweight core-only package is also available if you don't need the full plugin suite.

Copy-paste prompts

Prompt 1
Install better-scroll via npm and wire it up to a div wrapper with a tall child list
Prompt 2
Add the pull to refresh plugin to a better-scroll instance and call my API to reload data
Prompt 3
Show me how to use better-scroll inside a Vue 3 component without breaking SSR
Prompt 4
Configure better-scroll for an infinite scroll feed that loads 20 more items at a time

Frequently asked questions

What is better-scroll?

JavaScript scrolling library that fixes janky mobile scrolling. Drop-in engine with plugins for pull-to-refresh, infinite scroll, and zoom on any wrapper element.

What language is better-scroll written in?

Mainly TypeScript. The stack also includes TypeScript, JavaScript, npm.

How hard is better-scroll to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is better-scroll for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub ustbhuangyi on gitmyhub

Verify against the repo before relying on details.