bloody-offset

gets an element's offset

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
bloody-offset
100.0.08 years ago8 years agoMinified + gzip package size for bloody-offset in KB

Readme

offset
browser support

install

$ npm install bloody-offset

require

var offset = require("bloody-offset")

api

offset(element) > object

returns element's offset
  • object.height : integer, element's height
  • object.width : integer, element's width
  • object.top : integer, element's top offset
  • object.left : integer, element's left offset

example

var elementOffset = offset(element)

lightbox.style.top = elementOffset.top + "px"
lightbox.style.left = elementOffset.left + "px"
lightbox.style.display = "block"