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 position -
placement
- 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