Home Reference Source
import IntersectionEvents from 'intersection-events/src/index.js'
public class | source

IntersectionEvents

Wrapper of IntersectionObserver

Constructor Summary

Public Constructor
public

constructor(target: string | NodeList | Element | Element[], options: Object)

Method Summary

Public Methods
public
public

Public Constructors

public constructor(target: string | NodeList | Element | Element[], options: Object) source

Params:

NameTypeAttributeDescription
target string | NodeList | Element | Element[]

Target elements (selector or element object)

options Object
options.onEnter handler

Event handler when the element enters window

options.onLeave handler
  • optional
  • default: noop

Event handler when the element leaves window

options.enterThreshold number
  • optional
  • default: 1

Threshold when element enters window

options.leaveThreshold number
  • optional
  • default: 0

Threshold when element leaves window

options.isOnce boolean
  • optional
  • default: false

Whether to detect enter only once

Public Methods

public destroy() source

public execute() source