Skip to content
New: Customize your theme with an AI assistant. Read the guide

Smooth Scroll

Files: src/config/config.toml · Skill level: Beginner

With smooth scroll on, scrolling with a mouse wheel or trackpad glides instead of jumping line by line. It uses a small library called Lenis, which loads after the page has finished its first work, so it doesn’t slow the first view.

Lotline ships with smooth scroll off. The browser’s own scrolling feels right on most devices, and the scroll motion (reveals, parallax, the pinned listings row) works the same either way.

When it’s on, it still stays out of the way:

  • Phones and tablets keep their normal touch scrolling.
  • Visitors who turn on reduce motion in their device settings keep the browser’s normal scrolling.
  • Long lists inside the menu, dropdowns and text areas keep their own scrolling.

Turn It On

src/config/config.toml
[effects]
smoothScroll = true

Settings

The feel is tuned in [settings.smoothScroll]. The on and off switch is [effects] smoothScroll above, not a key here.

[settings.smoothScroll]
respectReducedMotion = true
duration = 1.1 # Higher value feels slower and smoother
easing = "expo" # expo | linear | easeOutQuad | easeOutCubic
smoothWheel = true
syncTouch = false
wheelMultiplier = 1
touchMultiplier = 1
anchors = true
autoRaf = true
stopInertiaOnNavigate = true
SettingWhat it does
respectReducedMotiontrue turns smooth scroll off for visitors who ask for reduced motion. Keep it on
durationHow long the glide lasts, in seconds. Higher feels slower and smoother
easingThe feel of the glide: expo, linear, easeOutQuad or easeOutCubic
smoothWheelSmooths mouse wheel and trackpad scrolling
syncTouchApplies smoothing to touch input on devices that have both a mouse and a touchscreen
wheelMultiplierHow far one wheel movement scrolls. 1 is normal
touchMultiplierHow far one swipe scrolls when syncTouch is on. 1 is normal
anchorsGlides to #section links on the same page instead of jumping
autoRafLets Lenis run its own animation loop. Leave it on
stopInertiaOnNavigateStops any glide that’s still running when a visitor clicks a link

To change the feel, adjust duration first. Restart npm run dev if a change doesn’t show.

For Developers

The Lenis instance is window.__themeLenis. It exists only where smooth scroll is running, so check for it first:

// Pause scrolling while something is open
window.__themeLenis?.stop();
window.__themeLenis?.start();
// Scroll to an element
window.__themeLenis?.scrollTo("#inquiry");

An element with its own scroll area, such as a long list, should keep native scrolling. Add data-lenis-prevent to it:

<div class="overflow-y-auto" data-lenis-prevent>...</div>

The code is in src/layouts/components/widgets/GlobalScripts.astro.

Do It With AI

Turn on smooth scrolling and make it feel [SLOWER / FASTER]. In src/config/config.toml, set
[effects] smoothScroll = true and change only the duration value under [settings.smoothScroll].
Keep respectReducedMotion = true and don't change any other key.
Type something to search...