Back to Skills

locomotive-scroll

Comprehensive skill for Locomotive Scroll smooth scrolling library with parallax effects, viewport detection, and scroll-driven animations. Use this skill when implementing smooth scrolling experiences, creating parallax effects, building scroll-triggered animations, or developing immersive scrolling websites. Triggers on tasks involving Locomotive Scroll, smooth scrolling, parallax, scroll detection, scroll events, sticky elements, horizontal scrolling, or GSAP ScrollTrigger integration. Integr

705stars119forksUpdated 8/13/2026

Security Assessment

Safe(95/100)
Security Score95/100

About locomotive-scroll

The locomotive-scroll skill is a comprehensive guide to implementing smooth scrolling, parallax effects, and scroll-driven animations with the Locomotive Scroll JavaScript library. It solves the problem of building immersive, Apple-style scroll experiences — hardware-accelerated smooth scroll, element-level parallax, viewport detection, sticky elements, and horizontal scrolling — with correct markup and configuration rather than trial and error.

The skill explains the required HTML structure (data-scroll-container, data-scroll-section, and per-element data-scroll attributes), initialization options (smooth, lerp, multiplier, class, repeat, offset), and a full table of data attributes for parallax speed and direction, sticky positioning, trigger offsets, repeat detection, call events, and element IDs. It documents common patterns including basic smooth scrolling, multi-layer parallax, sticky elements, scroll-call callbacks, per-element progress tracking (0 to 1), and programmatic scrollTo with offset, duration, and callback. It ships a Vite starter template (index.html, main.js, style.css, package.json) and Python helper scripts for config generation and integration, plus API and GSAP-integration references. Importantly, it flags accessibility and performance trade-offs — scroll-hijacking impact, prefers-reduced-motion detection, mobile touch differences, and disabling smooth scroll on low-end devices — and covers cleanup (destroy) and resize handling (update).

It targets front-end and creative web developers building landing pages, storytelling sites, and long-form content that need depth and motion. Typical uses include adding smooth scroll, layering parallax, pinning sticky elements, triggering animations on viewport entry, and integrating with GSAP ScrollTrigger. All code is standard client-side front-end; the docs reference the public jsDelivr CDN for the library.

FAQ

What HTML structure does Locomotive Scroll require?

A data-scroll-container wrapper, optional data-scroll-section blocks (which improve performance), and data-scroll attributes on tracked elements. Additional attributes like data-scroll-speed, data-scroll-sticky, data-scroll-call, and data-scroll-id control parallax, sticky behavior, callbacks, and identification.

How is it installed?

Via npm install locomotive-scroll with ES6 imports of the library and its CSS, or through the jsDelivr CDN. The skill also ships a Vite-based starter template.

Does it address accessibility?

Yes. It flags that scroll-hijacking can impact accessibility and recommends providing a disable option, detecting prefers-reduced-motion to set smooth: false, and testing mobile touch scrolling extensively.

Can it integrate with GSAP?

Yes. It integrates with GSAP for advanced scroll-driven animations and includes a dedicated gsap_integration reference.

What performance and cleanup practices does it recommend?

Segment long pages with data-scroll-section, call scroll.update() after DOM changes and on debounced resize, destroy the instance on unload, and consider disabling smooth scroll or reducing parallax on smartphones and low-end devices.

All Files

10 files
assets/starter_locomotive/index.html4.3 KB
View
scripts/generate_config.py10.9 KB
View
assets/starter_locomotive/main.js3.7 KB
View
scripts/integration_helper.py13.6 KB
View
assets/starter_locomotive/package.json0.3 KB
View
assets/starter_locomotive/README.md6.7 KB
View
assets/starter_locomotive/style.css5.1 KB
View
references/api_reference.md11.6 KB
View
references/gsap_integration.md13.0 KB
View
SKILL.md12.1 KB
View

Install locomotive-scroll

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill