This package has been deprecated

Author message:

Moved to GitHub Packages

@zestia/position-utils

7.0.3 • Public • Published

@zestia/position-utils

Utils for determining the position of an element within another element, and positioning elements near other elements. Note that 'auto' positioning is intentionally not part of this library.

getPosition

Returns where element is considered to be positioned inside container, based on a bounding box created by splitting the container into columns and rows.

Examples

// Get position of element inside container, could be in 1 of 9 possible positions
getPosition(element, container, 3, 3);
// As above, but with edge positions less likely to be considered
getPosition(element, container, 5, 5);

getCoords

Returns the coordinates required to place element at position, on the outside edge of reference.

Example

// Get coords to position element at the bottom left of reference
getCoords('bottom left', element, reference);

/@zestia/position-utils/

    Package Sidebar

    Install

    npm i @zestia/position-utils

    Weekly Downloads

    0

    Version

    7.0.3

    License

    MIT

    Unpacked Size

    6.02 kB

    Total Files

    3

    Last publish

    Collaborators

    • philliphaines
    • amk221