Locomotive Scroll is a lightweight JavaScript library for detecting elements in the viewport, triggering animations, and implementing smooth scrolling with parallax effects.
The library solves the problem of coordinating scroll-based animations and smooth scrolling behavior across web pages. It uses dual Intersection Observers to optimize detection separately for triggers and animations, and it builds on Lenis to provide smooth scrolling with improved performance. The tool automatically disables parallax effects on mobile devices through smart touch detection, reducing unnecessary processing on smaller screens.
Developers building interactive scroll experiences should consider this tool if they need a compact solution that handles both viewport detection and smooth scrolling in a single package. The library is particularly suited for projects where file size matters, as it compresses to only 9.4 kilobytes gzipped. It is built with TypeScript first, meaning full type support is native rather than added afterward. The tool maintains accessibility by preserving native scrollbars and keyboard navigation while providing proper ARIA support, making it suitable for projects with accessibility requirements.
The project maintains active issue tracking through GitHub Issues. Development follows a TypeScript-first approach, indicating a commitment to type safety from the ground up. The codebase is built on top of Lenis, integrating with an external scroll library rather than implementing smooth scrolling independently.