verge is a compact set of cross-browser viewport utilities written in native JavaScript. It includes the ability to detect if an element is in the current viewport. It works as a standalone module, an ender module, or as a jQuery plugin. (npm: verge)

Get an a object containing the properties top, bottom, left, right, width, and height with respect to the top-left corner of the current viewport, and with an optional cushion amount. Its return is like that of the native getBoundingClientRect.

The optional cushion parameter is an amount of pixels to act as a cushion around the element. If none is provided then it defaults to 0 and the rectangle will match the native rectangle. If a cushion is specified, the properties are adjusted according to the cushion amount. If the cushion is positive the rectangle will represent an area that is larger that the actual element. If the cushion is negative then the rectangle will represent an area that is smaller that the actual element.