Capítulo 321 de 411

Chapter 321: .scrollTo

Core Idea

Scrolls to a particular position or element

Key Concepts

  • target: Number | String | Element

  • smooth: Boolean

  • position: String

Code Examples

let smoother = ScrollSmoother.create({...});

button.addEventListener("click", () => smoother.scrollTo("#box1", true, "top 100px"));
  • What it demonstrates: typical usage of .scrollTo in a GSAP animation.

Key Takeaways

  1. target: Number | String | Element

  2. smooth: Boolean

  3. position: String

Connects To