0.0.4 • Published 6 years ago

view-in v0.0.4

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

ViewIn.js

ViewIn(tersector) is a simple utility to apply and remove classes to DOM elements as they enter the view port, using the Intersection Observer API.

Usage

viewIn('.my-selector', options);

Options

OptionTypeDefaultDescription
classOnEnterstringinview-enterClass added when element is visible
classOnExitstringinview-exitClass added was visible but then exits viewport
exitThresholdnumber0.75% of element visible to trigger exit
enterThresholdnumber0.75% of element visible to trigger enter

To Do

  • Add Interes feature detection
  • Allow a callback to be passed for exit and enter
  • Make options ... optional
  • Error cases
  • once: boolean - only trigger the observerable once