Skip to content

Know when elements are about to scroll into the viewport

Notifications You must be signed in to change notification settings

freqdec/peekaboo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Peekaboo

Fires a one-time event whenever elements of your choice are about to scroll into the viewport. Perfect for just-in-time asset loading, for example; images, javascript libraries such as twitter and facebook, article comments or 3rd party advertisments.

  • Uses the very fast IntersectionObserver API where possible
  • Fallsback to using a single scroll and resize event in other browsers but hooks into requestAnimationFrame to stop scroll jank
  • Correctly calculates if an observed element is hidden in the overflow of a parent element
  • A little over 1k when minified & gzipped

See the gitHub pages demo site for more info.

About

Know when elements are about to scroll into the viewport

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published