Skip to content

micro-js/position-element

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Position an element relative to another element

Resources

Stars

Watchers

Forks

Packages

No packages published