LayerwiseLayerwise
  • Features
  • Pricing
  • Templates
  • Docs
DownloadDownload
FeaturesPricingTemplatesDocsAI Website BuilderVibe CodingPersonal Software
DownloadDownload
  1. Glossary
  2. /
  3. Scroll effects

Smooth scrolling

Also called smooth scroll or scroll-behavior: smooth

Animated scrolling that glides to a new position, such as the target of an anchor link, so readers can see where on the page they went.

import type { MouseEvent } from 'react';
import { useReducedMotion } from 'motion/react';

const sections = [
  { id: 'features', title: 'Features' },
  { id: 'pricing', title: 'Pricing' },
  { id: 'faq', title: 'FAQ' }
];

export function LandingPage() {
  const reduceMotion = useReducedMotion();

  function jump(event: MouseEvent<HTMLAnchorElement>, id: string) {
    const target = document.getElementById(id);
    if (!target) return;
    event.preventDefault();
    // Glide there, or jump instantly for people who prefer less motion.
    target.scrollIntoView({ behavior: reduceMotion ? 'auto' : 'smooth' });
    // Move focus as well so the next Tab starts from the section, without cutting the glide short.
    target.focus({ preventScroll: true });
    history.pushState(null, '', `#${id}`);
  }

  return (
    <>
      <nav className='sticky top-0 z-10 flex h-16 items-center gap-6 border-b bg-background px-6 text-sm font-medium'>
        {sections.map((section) => (
          <a
            key={section.id}
            href={`#${section.id}`}
            onClick={(event) => jump(event, section.id)}
            className='text-muted-foreground hover:text-foreground'
          >
            {section.title}
          </a>
        ))}
      </nav>
      {sections.map((section) => (
        // scroll-mt-20 (80px) keeps the 64px sticky nav from covering the heading.
        <section
          key={section.id}
          id={section.id}
          tabIndex={-1}
          className='min-h-screen scroll-mt-20 px-6 py-16 outline-none'
        >
          <h2 className='text-2xl font-semibold'>{section.title}</h2>
        </section>
      ))}
    </>
  );
}
Turn on smooth scrolling for the in-page navigation: set scroll-behavior: smooth on html inside @media (prefers-reduced-motion: no-preference), add scroll-margin-top: 80px to each section so the sticky header doesn’t cover its heading, and move keyboard focus to the target section after the jump.

Paste into Layerwise or any AI coding tool.

What is Smooth scrolling?

By default, clicking a link to #pricing jumps there instantly, which can leave readers unsure whether they moved up or down the page. Smooth scrolling animates the trip: the page glides to the target over a few hundred milliseconds, and the reader keeps their bearings.

One line of CSS turns it on for anchor links and scripted scrolls: scroll-behavior: smooth on the scrolling element, usually html. In JavaScript, pass behavior: 'smooth' to scrollTo() or scrollIntoView(). Add scroll-margin-top to the targets so a sticky header doesn’t cover them.

Some sites also use libraries such as Lenis that smooth out mouse wheel scrolling itself. That changes how every scroll feels, so use it with care. Either way, respect prefers-reduced-motion and jump instantly for people who ask for less motion.

Related terms

All terms

Scroll snap

A CSS feature that makes a scroll container settle on set points, so carousels and full-screen sections come to rest neatly on an item.

Sticky header

A top bar that stays pinned to the top of the screen while the page scrolls underneath it, so navigation is always one click away.

Ease-in-out

An easing curve that starts slowly, speeds up in the middle, and slows down again at the end, tracing an S shape on a graph.

Reduced motion

An operating system setting that asks apps to minimize movement, which websites detect with the prefers-reduced-motion media query.

Build it with Layerwise

Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.

DownloadDownloadRead the docs
LayerwiseLayerwise

Build full-stack web apps in minutes with AI.

Product

  • Features
  • Pricing
  • Download
  • Templates

Solutions

  • AI Website Builder
  • Vibe Coding
  • Personal Software

Resources

  • Documentation
  • Changelog
  • Blog
  • Vibe Coding Glossary
  • llms.txt
  • llms-full.txt

Company

  • About
  • Contact

Legal

  • Privacy
  • Analytics Privacy
  • Terms
  • Security
  • Abuse

© 2026 Layerwise. All rights reserved.

Entrances & exits

  • Fade in
  • Slide in
  • Scale in
  • Pop in
  • Blur in
  • Reveal animation
  • Enter and exit animations

Timing & sequencing

  • Duration
  • Delay
  • Keyframes
  • Tweening
  • Stagger
  • Orchestration
  • Fill mode
  • Stepped animation
  • Looping animation
  • Yoyo animation

Easing

  • Easing
  • Linear easing
  • Ease-in
  • Ease-out
  • Ease-in-out
  • Cubic-bezier
  • Asymmetric easing
  • Overshoot easing

Springs & physics

  • Spring animation
  • Stiffness
  • Damping
  • Mass
  • Bounce
  • Velocity
  • Momentum
  • Interruptible animation
  • Rubber-banding

Transforms

  • Translate
  • Scale
  • Rotate
  • Skew
  • 3D flip
  • Perspective
  • Transform origin
  • Origin-aware animation

State transitions

  • Crossfade
  • Morph
  • Shared element transition
  • Layout animation
  • Height auto animation
  • Direction-aware transition
  • Continuity transition
  • Page transition
  • View Transitions API

Scroll effects

  • Scroll reveal
  • Scroll-driven animation
  • Parallax scrolling
  • Scrollytelling
  • Scroll pinning
  • Horizontal scroll section
  • Scroll progress bar
  • Scroll snap
  • Smooth scrolling

Interaction feedback

  • Hover effect
  • Press feedback
  • Ripple effect
  • Shake animation
  • Hold to confirm
  • Drag gesture
  • Drag to reorder
  • Swipe to dismiss
  • Pull to refresh
  • Magnetic button
  • Custom cursor
  • 3D tilt card
  • Spotlight card

Text effects

  • Typewriter effect
  • Text scramble
  • Split text animation
  • Text morph
  • Rotating words
  • Gradient text
  • Shimmer text
  • Number ticker
  • Tabular numbers
  • Underline animation

Loops & ambient motion

  • Marquee
  • Pulse animation
  • Float animation
  • Orbit animation
  • Idle animation
  • Particle background
  • Border beam
  • Confetti
  • Animated gradient

Visual effects

  • Blur
  • Clip-path
  • Mask
  • Before/after slider
  • SVG line drawing
  • Lottie animation

Motion principles

  • Purposeful animation
  • Anticipation
  • Follow-through
  • Squash and stretch
  • Perceived performance
  • Frequency of use
  • Spatial consistency
  • Reduced motion

Animation performance

  • Frame rate (FPS)
  • Jank
  • GPU acceleration
  • will-change
  • Layout thrashing

Layout

  • Hero section
  • Above the fold
  • Sticky header
  • Sidebar
  • Bento grid
  • Card
  • Flexbox
  • CSS Grid
  • Padding vs margin
  • Responsive design
  • Container
  • Masonry layout
  • Split screen
  • Z-index
  • Overflow

Components

  • Button variants
  • Modal
  • Drawer
  • Popover
  • Tooltip
  • Dropdown menu
  • Context menu
  • Toast notification
  • Tabs
  • Segmented control
  • Accordion
  • Carousel
  • Command palette
  • Combobox
  • Toggle switch
  • Checkbox
  • Radio button
  • Date picker
  • Breadcrumb
  • Pagination
  • Infinite scroll
  • Badge
  • Avatar stack
  • Empty state
  • Skeleton screen
  • Spinner
  • Progress bar
  • Data table
  • Stepper
  • Floating label
  • Inline validation
  • Alert banner
  • Tag input

States & patterns

  • Interaction states
  • Focus ring
  • Loading state
  • Optimistic UI
  • Debounce
  • Lazy loading
  • Dark mode
  • Micro-interaction
  • Affordance
  • Undo
  • Drag and drop
  • Keyboard shortcut

Visual styles

  • Glassmorphism
  • Liquid glass
  • Neumorphism
  • Claymorphism
  • Neo-brutalism
  • Skeuomorphism
  • Flat design
  • Mesh gradient
  • Aurora background
  • Grain texture
  • Glow effect
  • Drop shadow
  • Border radius
  • Grid background
  • Typographic hierarchy
  • Accent color
  • Color contrast

Vibe coding & AI

  • Vibe coding
  • Prompt
  • Context window
  • Token
  • AI agent
  • Tool call
  • Hallucination
  • Diff
  • Live preview
  • Checkpoint
  • Git commit
  • Deploy
  • Frontend and backend
  • API
  • Database
  • Rules file
  • MCP
  • Plan mode
  • Visual edit

Instant jump

Features
Reviews
Pricing
FAQ

Smooth scroll

Features
Reviews
Pricing
FAQ