Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 548 Bytes

README.md

File metadata and controls

19 lines (14 loc) · 548 Bytes

pixelsDisplayed

A module for detecting whether an element is located within the viewport

Usage

var bvUIPixelsDisplayed = require('bv-ui-core/lib/pixelsDisplayed');
var pixelsDisplayedVertical = bvUIPixelsDisplayed.pixelsDisplayedVertical;
var pixelsDisplayedHorizontal = bvUIPixelsDisplayed.pixelsDisplayedHorizontal;


if (pixelsDisplayedVertical(element) > 0) {
  // element is vertically within viewport
  if (pixelsDisplayedHorizontal(element) > 0) {
    // element is both vertically and horizontally within viewport
  }
}