JSLite ??? ???
/ JSLite - 尺寸位置
JSLite - 尺寸位置
如有疑問歡迎到這些地方交流,歡迎加入JSLite.io組織團伙共同開發(fā)!
offset
獲得當前元素相對于document的位置。返回一個對象含有: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
獲取對象象集合中第一個元素的寬,或設置對象集合所有元素的寬。
$("#box").width() // => 342 $(window).width() // => 456 (可視區(qū)域?qū)挾? $(document).width() // => dsf
height
height() ? number
height(value) ? self
height(function(index, oldWidth){ ... }) ? self
獲取對象象集合中第一個元素的高,或設置對象集合所有元素的高。
$("#box").height() // => 342 $(window).height() // => 456 (可視區(qū)域高度) $(document).height() // => dsf
scrollLeft
scrollLeft() ? self 獲取匹配的元素集合中第一個元素的當前水平滾動條的位置
$("body").scrollLeft(400);
scrollTop
scrollTop() ? self 獲取匹配的元素集合中第一個元素的當前垂直滾動條的位置
$("body").scrollTop(400);