Socket
Book a DemoInstallSign in
Socket

inviewport

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inviewport

Check if a dom element is fully contained in the viewport

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

inviewport

Check if a dom element is fully contained in the viewport

Example

var inViewport = require('inviewport');

console.log(inViewport(document.querySelector('div')));

Installation

$ npm install inviewport

API

inViewport(el)

Return whether el is fully contained in the current viewport.

inViewport.watch(el, fn)

Call fn immediately and whenever it moves in or out of the viewport, with one boolean argument denoting visibility.

Returns an unwatch() function, which you can call to stop listening for DOM events.

License

MIT

FAQs

Package last updated on 07 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts