Skip to content

📜 A leak free performance focused scroll util

License

Notifications You must be signed in to change notification settings

noscripter/scrollin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scrollin

scrollin

**Do something great when an element enters the viewport.**










Install

npm i scrollin
bower i scrollin

Use

Scrollin.track(document.querySelector('#hi'), () => alert('hi!'))

Options

You can specify optional offset params to control when an elements is considered in the "viewport".

Scrollin.track(document.querySelector('#hi'), () => alert('hi!'), {
  top: 10,
  right: -10,
  bottom: 10,
  left: 10
})

API

  • Scrollin.track(document.querySelector('#hi'), () => alert('hi!'))
  • Scrollin.untrackAll()
  • Scrollin.untrack(document.querySelector('#hi'))
  • Scrollin.checkForVisibleElements()
  • Scrollin.getTracking()

Dev

  • npm i
  • npm run dev

Building

  • npm run compile

Polyfill Caveats

  • You may need to polyfill window.requestAnimationFrame
  • You may need to polyfill Array.prototype.splice
  • You may need to polyfill Array.prototype.some

📜

Build Status

About

📜 A leak free performance focused scroll util

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.6%
  • HTML 1.4%