Package Exports
- position.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (position.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
position.js
😉
Usage
Positions a popup element to an anchor element:
const {left, top} = position(popup, anchor, 'top')
Object.assign(popup.style, {left: `${left}px`, top: `${top}px`})API
position(popup, anchor, preset, options)
Options
{
// use fixed or absolute position, defaults to false
fixed: false,
// any scroller element, defaults to document.body
offsetParent: document.body,
}Presets
toprightbottomleftcentertop-lefttop-rightright-topright-bottombottom-leftbottom-rightleft-topleft-bottom
Combos
position(popup, anchor, {popup: 'left-top', anchor: 'right-top'})
// same as `right-top` preset
position(popup, anchor, 'right-top')