JSLite - size position
If you have any questions, you are welcome to communicate in these places, and you are welcome to join the JSLite.io organization team for joint development!
offset
Get the position of the current element relative to the document. Returns an object containing: left|top|width|height
$("#box").offset() //⇒Object {left: 8, top: 8, width: 1260, height: 0} $("#box").offset().left //⇒ 8
width
width() ⇒ number
width(value) ⇒ self
width (function(index, oldWidth){ ... }) ⇒ self
Get the width of the first element in the object collection, or set the width of all elements in the object collection.
$("#box").width() // => 342 $(window).width() // => 456 (可视区域宽度) $(document).width() // => dsf
height
##height() ⇒ numberscrollLeftheight(value) ⇒ self
height(function(index, oldWidth){ ... } ) ⇒ self
Get the height of the first element in the object collection, or set the height of all elements in the object collection.$("#box").height() // => 342 $(window).height() // => 456 (可视区域高度) $(document).height() // => dsf
scrollLeft() ⇒ self Get the position of the current horizontal scroll bar of the first element in the matched element setscrollTop$("body").scrollLeft(400);
scrollTop() ⇒ self Get the current vertical scroll bar position of the first element in the matched element set$("body").scrollTop(400);