jQuery 樣式控制

2018-07-24 11:47 更新
.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í)元素


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)