rixutils

1.0.2 • Public • Published

RIXUTILS

  • monitor.js

    • Easy to use wrapper around IntersectionObserver browser API
    • Good for adding animation when elements appear on the screen
  • prefmotion.js

    • Good for determining whether to run motion intensive scripts.

Usage

monitor

const observe = monitor({ threshold: 0.2, trigger: 'once' })

observe(document.querySelector('#elementToObserve'), () => {
  // what to do when this element appears on the screen?
})

prefsmotion

prefersMotion(() => {
    console.log('im ok with motion')
  }, () => {
    console.log('im not ok with motion')
})

// 
if (isMotionPreferred()) {
  console.log('motion is OK')
} else {
  console.log('motion is NOT OK')
}

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i rixutils

      Weekly Downloads

      0

      Version

      1.0.2

      License

      MIT

      Unpacked Size

      4.94 kB

      Total Files

      7

      Last publish

      Collaborators

      • sandruso