Skip to content

Latest commit

 

History

History
29 lines (19 loc) · 693 Bytes

README.md

File metadata and controls

29 lines (19 loc) · 693 Bytes

composed-offset-position

This provides a set of ponyfills to achieve the same behavior of offsetParent, offsetLeft and offsetTop before the offsetParent spec was changed.

Installation

Using npm:

$ npm i --save-dev composed-offset-position

Usage

import { offsetLeft, offsetParent, offsetTop } from "composed-offset-position";

console.log(offsetLeft(element));
// ➡️ 0
console.log(offsetTop(element));
// ➡️ 20

console.log(offsetParent(element));
// ➡️ [object HTMLDivElement]

Notes