I have a grid of floated, fixed-sized boxes in a container. I need to get the position of each box relative to the container using JS/jQuery. I know I can set position: relative on the container and use jQuery $box.position(), but it doesn't work because my <body> is scaled using transform: scale(). (I have another script that scales the <body> to match the viewport width, similar to this, but for this question, just know that the <body> will have transform: scale() with some arbitrary scaling factor.)
jQuery's $box.position() seems to return the position after scaling, but I want the original position before scaling. For example, if each box has width: 300px; margin-right: 10px, then a box in the third column should have left offset 620px (before scaling). However, $box.position().left gives 310px (after scaling) if the <body> has transform: scale(0.5).
Is there a way to get the position before scaling, without knowing the scaling factor? I found the native DOM method getBoundingClientRect(), but (1) it still gives the position after scaling and (2) it's relative to the viewport rather than the container.
Thanks.