JavaScript getBoundingClientRect () vs offsetHeight when calculating element height
1 answer
In most cases, they are the same width and height as getBoundingClientRect () when there are no transformations applied to the element. In case of transformations, offsetWidth and offsetHeight returns the width and height of the element's layout, and getBoundingClientRect () returns the width and height of the render. For example, if the element has a width: 100 pixels; and transform: scale (0.5); getBoundingClientRect () will return 50 as the width and offsetWidth will return 100.
+2
source to share