Capítulo 318 de 411

Chapter 318: .offset

Core Idea

Calculates the numeric offset (scroll position in pixels) that corresponds to when a particular element reaches the specified position like:

Key Concepts

  • target: String | Element

  • position: String

Code Examples

// when the top of #box1 hits 100px down from the top of the viewport
let offset = smoother.offset("#box1", "top 100px");
  • What it demonstrates: typical usage of .offset in a GSAP animation.

Key Takeaways

  1. target: String | Element

  2. position: String