1.0.0 • Published 3 years ago

@peter.ingram/section-s v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

SectionS

A tiny 3kb class to detect the page section the user is on.

Usage:

new SectionS(options)
  .changed((index, hasClass) => {
    console.log('entered section', index, has)
  })

Options:

You can provide the following optional options

interface Options {
  selector: string // class to detect default: '.section'
  offset: number | null // minus or add an offset default: null
  has: string | null // check for certain class. Returned in the 'hasClass' on the changed event
}

Yarn / NPM:

yarn add @peter.ingram/section-s