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

Global Scripts & Interactions

Files: src/layouts/components/widgets/GlobalScripts.astro, src/config/config.toml · Skill level: Beginner

src/layouts/components/widgets/GlobalScripts.astro initializes Veltro’s shared client behavior.

It handles:

  • accordions, collapse, selects, tabs, and tooltips, loaded when the page has them
  • Lenis smooth scrolling and the page-jump keyboard shortcuts
  • AOS reveal animations for marked content, off on phones and for visitors who ask for reduced motion
  • the cursor follower
  • section-title motion
  • sticky sidebars
  • horizontal scrolling and theme-specific hover interactions

The serialized client config is exposed as window.__themeConfig and contains the settings.smoothScroll, settings.pageJump, and settings.cursor blocks. In the Tina and Sanity editions, these are in Site settings > Settings.

Smooth Scroll

[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

Lenis is off on touch devices, and when reduced motion is requested and respected. The running instance is window.__themeLenis. See Smooth Scroll for what each setting does.

Page Jump

[settings.pageJump]
enable = true
duration = 0.9

These keys jump to the top or bottom of the page while smooth scroll is on. On macOS, it’s Command + Arrow. On Windows, it’s Ctrl + Home or End. On all systems, it’s Home or End.

Cursor

[settings.cursor]
enable = true
size = 20
hoverSize = 70
opacity = 0.5
borderWidth = 2
followRatio = 0.15

The cursor is automatically disabled on touch and coarse-pointer devices.

Heavier behavior is loaded during idle time or after the first relevant interaction. The header menu has its own script in src/layouts/components/global/header/NavStage.astro, and doesn’t wait for this. See Navigation.

Type something to search...