locomotivemtl /locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.

★ 8,899⑂ 1,111👁 70⑃ 153● 498▤ 17
TypeScriptMITCreated 2016-10-12scroll.locomotive.ca
Download: v5.1.1v5.1.1 ↓5.1.12026-11-13
+1
Daily
8,899
stars
1,111
forks
70
watchers
153
prs
498
issues
17
releases

README

Locomotive Scroll





A lightweight & modern scroll library for detection, animation, and smooth scrolling. Built on top of Lenis.

 Documentation

Full documentation available at scroll.locomotive.ca/docs.

 Quick Start

bash
npm install locomotive-scroll


js
import LocomotiveScroll from 'locomotive-scroll';

const scroll = new LocomotiveScroll();


css
@import 'locomotive-scroll/dist/locomotive-scroll.css';


html
I move at half speed


 Features

-   Lightweight — Only 9.9kB gzipped
-   TypeScript First — Fully typed
-   Built on Lenis — Latest stable release with improved performance
-   Dual Intersection Observers — Optimized detection for triggers vs. animations
-   Smart Touch Detection — Parallax auto-disabled on mobile
-   Accessible — Native scrollbar, keyboard navigation, proper ARIA support

 Demo

Check out the examples and playground

 Support

GitHub Issues

Top issues

Latest release

v5.1.1 v5.1.1 2026-11-13
Fixed

- An element with data-scroll-delay stops rendering once it is out of the viewport. It used to update its transform on every frame while scrolling and for about 1.5 seconds after. It now jumps to its final position out of sight, and resumes from there when it comes back.
- data-scroll-position="start,end", the documented default, no longer puts the element in the per-frame loop. The library compared it to top,bottom instead. An explicit top,bottom now gets the per-frame loop, with the same result as before.
- Scroll elements are measured once per resize instead of twice. The library lis

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON