JSFiddle - React, Tailwind, and code Playground
HTML
<div class="not offset">
<div class="real offset">
<div class="test">Test Content</div>
</div>
</div>
<button>Get offset of test content</button>
CSS
.offset {
background-color: rgba(0, 0, 0, 0.1);
padding: 1em;
}
.not.offset {
position: relative;
}
.real.offset {
transform: rotateZ(0deg);
-moz-transform: rotateZ(0deg);
-webkit-transform: rotateZ(0deg);
}
.test {
position: absolute;
top: 0px;
left: 0px;
}
button {
margin-top: 1em;
}
JavaScript
$('button')
.on('click', function() {
alert( $('.test').offsetParent().attr('class') );
})
;