@f/position-element
v1.1.3
Published
Position an element relative to another element
Downloads
10
Readme
position-element
Position an element relative to another element
Installation
$ npm install @f/position-element
Usage
var position = require('@f/position-element')
function positionTooltip (tooltip, target, placement) {
position(tooltip, target, placement)
}
API
positionElement(node, placement, options)
node
- The DOM node you want to positionplacement
- One oftop/right/bottom/left
. How to positionnode
relative tonear
. (e.g.top
aligns the bottom edge ofnode
with the top edge ofnear
, horizontally centered)options
- Optional. Options object containing:near
- The DOM node you want to positionnode
relative to. If not specified,node
's offsetParent is used.space
- Optional. Defaults to0
. Specifies how much padding to add
Returns: void
License
MIT