# Smooth Scroll

## Smooth Scroll

**File:** `src/config/config.toml` · **Skill level:** Beginner

Givo softens mouse-wheel scrolling with [Lenis](https://lenis.darkroom.engineering/), a small scrolling library. Pages glide a little after each turn of the wheel, and links to a part of the page (such as `/donate/#give`) scroll there smoothly. The script loads after the page has finished loading, so it does not slow down the first view.

It turns itself off when it would get in the way:

- On touch-only devices (phones and most tablets), which keep their own scrolling.
- For visitors who turn on **reduce motion** in their device settings, while `respectReducedMotion` is `true`.

### Settings
The settings are in `[settings.smoothScroll]` in `src/config/config.toml`:

```toml
[settings.smoothScroll]
  enable                = true
  respectReducedMotion  = true
  duration              = 1.1
  easing                = "expo"
  smoothWheel           = true
  syncTouch             = false
  wheelMultiplier       = 1
  touchMultiplier       = 1
  anchors               = true
  autoRaf               = true
  stopInertiaOnNavigate = true
```

| Setting                 | What it does                                                                                   |
| ----------------------- | ---------------------------------------------------------------------------------------------- |
| `enable`                | `false` keeps the browser's normal scrolling everywhere                                        |
| `respectReducedMotion`  | `true` turns smooth scrolling off for visitors who ask for reduced motion. Keep it `true`      |
| `duration`              | How long one scroll takes to settle, in seconds. Higher feels slower and softer                |
| `easing`                | The shape of the slow-down: `expo`, `linear`, `easeOutQuad`, or `easeOutCubic`                 |
| `smoothWheel`           | Smooths mouse-wheel and trackpad scrolling                                                     |
| `syncTouch`             | Smooths touch scrolling too. Leave it `false`                                                  |
| `wheelMultiplier`       | Distance per wheel step. `1` is normal, `0.8` is shorter                                       |
| `touchMultiplier`       | Distance per swipe, used only with `syncTouch`                                                 |
| `anchors`               | Smooth scrolling for links to a part of the page                                               |
| `autoRaf`               | Lets Lenis run its own animation loop. Leave it `true`                                         |
| `stopInertiaOnNavigate` | Stops the glide when a visitor follows a link                                                  |

To turn it off, set `enable = false`. Nothing else changes.

<Aside type="tip">
  A part of the page that scrolls by itself (a long list in a panel, for
  example) needs the attribute `data-lenis-prevent`, so the wheel scrolls that
  part and not the page. The theme's own panels already have it.
</Aside>

### Related Settings
- `[settings.animation]` sets the gentle fade-in of sections as they scroll into view. See [Animations](/givo/customization/animations/).
- `stickyHeader` in `[settings]` keeps the header pinned while scrolling. See [Header](/givo/customization/header/).

For developers: the script is loaded by `src/layouts/components/widgets/GlobalScripts.astro` and is available as `window.__themeLenis` once it has started.

### Do It With AI
```text
Make smooth scrolling on my Givo site feel [faster / slower / off]. Change only
[settings.smoothScroll] in src/config/config.toml, keep respectReducedMotion = true, and tell me
which values you changed.
```