一、前言 接著上一章的內容,繼續JQuery的學習 二、內容 ...
一、前言
接著上一章的內容,繼續JQuery的學習
二、內容
css 設置或返回匹配元素的樣式屬性
$(selector).css(css-property-name)
$(selector).css(css-property-name,value)
$(selector).css({property:value, property:value, ...})
$(selector).css(css-property-name,function(index,currentvalue))
height 設置或返回匹配元素的高度
$(selector).height()
$(selector).height(num)
$(selector).height(function(index,currentheight))
width 設置或返回匹配元素的寬度
$(selector).width()
$(selector).width(num)
$(selector).width(function(index,currentwidth))
position 返回匹配元素相對於父元素的位置(偏移)
返回的對象包含兩個整型屬性:top 和 left
$(selector).position()
scrollLeft 設置或返回匹配元素相對滾動條左側的偏移
$(selector).scrollLect()
$(selector).scrollLeft(new-position)
scrollTop 設置或返回匹配元素的滾動條的垂直元素
$(selector).scrollTop()
$(selector).scrollTop(offset)
offset 返回或設置匹配元素相對於文檔的偏移
$(selector).offset()
$(selector).offset(value)
$(selector).offset(function(index,currentoffset))
offsetParent 返回最近的祖先定位元素
$(selector).offsetParent()