Position an element relative to another element
$ npm install @f/position-element
var position = require('@f/position-element')
function positionTooltip (tooltip, target, placement) {
position(tooltip, target, placement)
}
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
MIT