.getBox()
Available on: InDomReturns a DOMRect with the underlying element’s viewport-relative bounding box.Returns: {DOMRect} - Native object with left / x, top / y, width, height, right, bottom.Throws:
Error - If the underlying element has been removed
Error - If the underlying element is not connected to the document
Examples:const div = $n('<div></div>');
div.setStyle({
display: 'inline-block',
position: 'fixed',
top: '110px',
left: '130px',
width: '100px',
height: '150px',
backgroundColor: 'blue'
});
//console.log(div.getBox());
console.log(JSON.stringify(div.getBox()));
//DOMRect {"x":0,"y":0,"width":0,"height":0,"top":0,"right":0,"bottom":0,"left":0}
//because it is not yet connected to DOM
$1('body').append(div);
console.log(div.getBox());
console.log(JSON.stringify(div.getBox()));
//DOMRect {"x":130,"y":110,"width":100,"height":150,"top":110,"right":230,
//"bottom":260,"left":130}Next: getOuterBox »