Capítulo 347 de 411

Chapter 347: .scroll

Core Idea

Gets/Sets the scroll position of the associated scroller (numeric).

Key Concepts

  • position: Number

Code Examples

let st = ScrollTrigger.create({
  trigger: ".class",
  scroller: ".container", // if no scroller is defined, the viewport (window) is used.
  start: "top center",
  end: "+=500",
});

// get
let position = st.scroll();

// set
st.scroll(100);
  • What it demonstrates: typical usage of .scroll in a GSAP animation.

Key Takeaways

  1. position: Number