Skip to content

jkroso/position

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

position

DOM element position utilities

Installation

npm install jkroso/position

then in your app:

var position = require('position')

API

position()

Get the location of the element relative to the top left of the documentElement

-> {top, right, bottom, left, width, height} in pixels

offset()

Get the position of one element relative to another

offset(child)
offset(child, parent) // => {x, y}

containerBox()

Determine the perimeter of an elements containing block. This is the box that determines the childs positioning. The container cords are relative to the document element not the viewport; so take into account scrolling.

offsetParent()

Get the element that serves as the base for this ones positioning. If no parents are postioned it will return undefined which isn't what you might expect if you know the offsetparent spec or have used jQuery.offsetParent

About

utilities for working with positioned DOM elements

Resources

License

Stars

Watchers

Forks

Packages

No packages published