<div class="modal">
<h1> Hi!</h1>
<p> test </p>
<h1> Hi! </h1>
</div>
const parentPos = document.getElementById('parent-id').getBoundingClientRect(),
const childPos = document.getElementById('child-id').getBoundingClientRect(),
const relativePos = const {
top: childPos.top - parentPos.top,
right: childPos.right - parentPos.right,
bottom: childPos.bottom - parentPos.bottom,
left: childPos.left - parentPos.left,
};