0.1.1-beta • Published 6 years ago

pointer.js v0.1.1-beta

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

pointer.js

Travis CI Build JavaScript Style Guide

A waypoint library to find your place in the DOM. Pointer.js is built on the experimental Intersection Observer API to determine if an element is visible in the viewport. Pointer.js is ready to use across all browsers and all devices.

Installation

Source
npmnpm install pointer.js --save
yarnyarn add pointer.js
unpkghttps://unpkg.com/pointer.js

Usage

var waypoint = new Pointer({
  element: document.querySelector('.js-waypoint'),
  handler: function (entry) {
    alert('The element is in view!')
  }
})

API

new Pointer(options)

options: A Javascript object containing Pointer options. This object is required. It must contain element and handler properties.

options.element: A document element that you wish to set as the waypoint.

options.handler: A function that executes when the options.element is in view. The function passes an Intersection Observer Entry.

Copyright & Licensing

Copyright 2018 Anthony Gonzales. Code released under the MIT License.