Hydrophone
Track when a DOM node enters or leaves the screen.
Get Started
npm install hydrophone
API
add(node, events)
Start tracking a DOM node.
node
: DOM node object. (Node)events
: Object, containing zero or more of the following properties:enters
: Function called when the element enters the viewport. (Function)leaves
: Function called when the element exits the viewport. (Function)
remove(node)
Stop tracking a DOM node.
node
: DOM node object. (Node)
Usage
var node = document
License
See the License file.