- .css()
- 獲取或設(shè)置指定的 css 樣式:
$('body').css('background-color');
$('body').css('background-color', 'red');
$('body').css('background-color', function(index, value){return value + '1'});
$('body').css({color: 'green', 'background-color': 'red'});
- .width() .height()
- 獲取或設(shè)置元素的寬和高
$('body').width();
$('body').width(50);
$('body').width(function(index, value){return value += 10});
- .innerWidth() .innerHeight() .outerHeight() .outerWidth()
- 元素的其它尺寸值
- .scrollLeft() .scrollTop()
- 獲取或設(shè)置滾動(dòng)條的位置
- .offset() .position()
- 獲取元素的坐標(biāo)。 offset 是相對(duì)于 document , position 是相對(duì)于父級(jí)元素
更多建議: