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
-
target: Number | String | Element
-
smooth: Boolean
-
position: String
Connects To