MENU
Dimension And Position
| .height() .width() .innerHeight().innerWidth()Get the height/width of the first matched element. .height(String/Number value) .height(function(int index, int height) f) .width(String/Number value) .width(function(int index, int height) f) .innerHeight(String/Number value).innerHeight(function(int index, int height) f).innerWidth(String/Number value).innerWidth(function(int index, int height) f)Set the height/width for each matched element. .outerHeight([Boolean includeMargin]).outerWidth([Boolean includeMargin])Get the outer height/width of the first matched element. .offset() Get the coordinates of the first matched element, relative to the document. .offset(Object coords) .offset(function (int index, Object coords) f) Set the coordinates for each matched element, relative to the document. .position() Get the coordinates of the first matched element, relative to the offset parent. The returned object has two properties – 'top' and 'left'. .scrollLeft() .scrollTop() Get the horizontal/vertical position of the scroll bar for the first matched element. .scrollLeft(Number value) .scrollLeft(Number value) Set the horizontal/vertical position of the scroll bars for the matched elements. |
RESETRUNFULL
<!DOCTYPE html><html><head>
<script src="jquery-3.5.1.min.js"></script> </head><body>
<div style="background:orange;
width:300px; height:100px;
margin:15px; padding:15px"></div>
<script>
var d = $('div');
alert(d.height()); // 100
alert(d.innerHeight()); // 130
alert(d.outerHeight(true)); // 160
d.offset({top:50, left:200});
</script></body></html>