@lemuria/absolute-proxy

1.0.2 • Public • Published

@lemuria/absolute-proxy

npm version

@lemuria/absolute-proxy Assigns Styles To Position Element Absolutely On Top Of The Target One.

yarn add @lemuria/absolute-proxy

Table Of Contents

API

The package is available by importing its default function:

import absoluteProxy from '@lemuria/absolute-proxy'

absoluteProxy(
  obj: HTMLElement,
  element: HTMLElement,
): void

Computes the getBoundingClientRect and getComputedStyle of the target element to find out the position that should be set on the obj for it to appear on the same place on screen, but with absolute position (e.g., relative to body).

Accounts for padding and border.

import positionAbsolute from '@lemuria/absolute-proxy'

const obj = document.createElement('object')
obj.type = 'image/svg+xml'
obj.data = src

const element = document.getElementById('example')

positionAbsolute(obj, element)
window.addEventListener('resize', () => {
  positionAbsolute(obj, element)
})

Copyright

Art Deco © Art Deco 2019 Tech Nation Visa Tech Nation Visa Sucks

/@lemuria/absolute-proxy/

    Package Sidebar

    Install

    npm i @lemuria/absolute-proxy

    Weekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    7.83 kB

    Total Files

    11

    Last publish

    Collaborators

    • zvr