The second DOM element to compare.
true if the two DOM elements overlap.
import { doElementsOverlap } from '@untemps/utils/dom/doElementsOverlap'
const element1 = document.createElement('div')
element1.style = 'width: 140px; height: 140px; position: absolute; background-color: red;'
document.body.appendChild(element1)
const element2 = document.createElement('div')
element2.style = 'width: 130px; height: 130px; position: absolute; background-color: green;'
document.body.appendChild(element2)
const element3 = document.createElement('div')
element3.style = 'width: 130px; height: 130px; left: 250px; top: 250px; position: absolute; background-color: blue;'
document.body.appendChild(element3)
doElementsOverlap(element1, element2) // true
doElementsOverlap(element1, element3) // false
The first DOM element to compare.