Temukan ketinggian ruang di atas elemen menggunakan javascript

// Vanila JS \\
var elem = document.getElementById( 'elementId' );  // select the element
var heightAbove = elem.offsetTop;  // get the height above the selected element

// Using jQuery \\
var elem = $('div[id]'); // select the element
var heightAbove = elem.offset().top; // get the height above the selected element
CoderHomie