The most basic usage of ScrollTrigger is to trigger classes based on the current scroll position. E.g. when an element enters the viewport, fade it in. You can add custom offsets per element, or set offsets on the viewport (e.g. always trigger after the element reaches 20% of the viewport) When using the callbacks ScrollTrigger becomes really powerful. You can run custom code when an element enters/becomes visible, and even return Promises to halt the trigger if the callback fails. This makes lazy loading images very easy. The easiest way to start is to create a new instance and add some triggers to it, with all default values. This will toggle the 'visible' class when the element comes into the viewport and toggles the 'invisible' class when it scrolls out of the viewport. Adding callbacks / different classes can be done globally, this becomes the default for all triggers you add, or you can specify custom configuration when adding a trigger.

Features

  • Add some callbacks and custom classes
  • Execute callbacks on entering/leaving the viewport
  • Let your page react to scroll changes
  • The easiest way to start is to create a new instance and add some triggers to it
  • For more examples, checkout the /demo directory on GitHub
  • You can run custom code when an element enters/becomes visible

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow ScrollTrigger

ScrollTrigger Web Site

Other Useful Business Software
AI-powered service management for IT and enterprise teams Icon
AI-powered service management for IT and enterprise teams

Enterprise-grade ITSM, for every business

Give your IT, operations, and business teams the ability to deliver exceptional services—without the complexity. Maximize operational efficiency with refreshingly simple, AI-powered Freshservice.
Try it Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of ScrollTrigger!

Additional Project Details

Operating Systems

Windows

Programming Language

JavaScript

Related Categories

JavaScript User Interface (UI) Software, JavaScript Design Software

Registered

2022-06-17