Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find the height of space above element using 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
 
PREVIOUS NEXT
Tagged: #find #height #space #element #javascript
ADD COMMENT
Topic
Name
4+2 =