const d = document.getElementById("div1");
const topPos = d.offsetTop;
if (topPos > 10) {
// object offset is more
// than 10 pixels from its parent
}HTMLElement: offsetTop property / notebook
HTMLElement: offsetTop property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.