Last active: 2 years ago
const overlaps = (elementA: Element, elementB: Element) => {
const rectA = elementA.getBoundingClientRect();
const rectB = elementB.getBoundingClientRect();
return !(
rectA.right < rectB.left ||
rectA.left > rectB.right ||
rectA.bottom < rectB.top ||
rectA.top > rectB.bottom
);
};