1.1.3 • Published 8 years ago

@f/position-element v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

position-element

Build status Git tag NPM version Code style

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 of top/right/bottom/left. How to position node relative to near. (e.g. top aligns the bottom edge of node with the top edge of near, horizontally centered)
  • options - Optional. Options object containing:
    • near - The DOM node you want to position node relative to. If not specified, node's offsetParent is used.
    • space - Optional. Defaults to 0. Specifies how much padding to add

Returns: void

License

MIT