Skip to content

Commit

Permalink
chore: createElementAtPosition util
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer committed Mar 12, 2023
1 parent 503b590 commit 4e5d82e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/utils/create-element-at-position.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function createElementAtPosition(x = 0, y = 0, zIndex = 2147483647) {
const element = document.createElement('div')
element.style.position = 'absolute'
element.style.zIndex = zIndex
element.style.left = x + 'px'
element.style.top = y + 'px'
document.documentElement.appendChild(element)
return element
}

0 comments on commit 4e5d82e

Please sign in to comment.