Search results
A simple scroll library used by developers at Locomotive. Built as a layer on top of ayamflow's virtual-scroll, it provides smooth scrolling with support for parallax effects, toggling classes, and triggering event listeners when elements are in the viewport.
import LocomotiveScroll from 'locomotive-scroll'; const scroll = new LocomotiveScroll ({el: document. querySelector ('[data-scroll-container]'), smooth: true}); Note: scroll-sections are optional but recommended to improve performance, particularly in long pages.
Dec 16, 2020 · Locomotive scroll is a simple scroll library, built as a layer on top of ayamflow’s virtual-scroll, it provides smooth scrolling with support for parallax effects, toggling classes, and triggering event listeners when elements are in the viewport.
Locomotive Scroll. Detection of elements in viewport & smooth scrolling with parallax effects. Installation. ⚠️ Scroll-hijacking is a controversial practice that can cause usability, accessibility, and performance issues. Please use responsibly. npm install locomotive-scroll. Usage. Basic. With simple detection. HTML.
🛤 Detection of elements in viewport & smooth scrolling with parallax. - locomotivemtl/locomotive-scroll
import LocomotiveScroll from 'locomotive-scroll'; const scroll = new LocomotiveScroll({ el: document.querySelector('[data-scroll-container]'), smooth: true }); Note: scroll-sections are optional but recommended to improve performance, particularly in long pages.
Add the base styles to your CSS file. [`locomotive-scroll.css`](https://github.com/locomotivemtl/locomotive-scroll/blob/master/dist/locomotive-scroll.css) #### JS. ##### With a bundler. ```js. import LocomotiveScroll from 'locomotive-scroll'; const scroll = new LocomotiveScroll(); ```. ##### Or without.