// Return the size of an element and its position relative to the viewport: const rect = obj.getBoundingClientRect(); console.log(rect)