CSS
CSS
位置
尺寸
26
设置属性 css $().css({"height":"200px","width":"100px"})
位置offset 距离页面的偏移 position是距离有position属性的父元素的距离
scrollTop滚动高度
27 如果导航条的scrollTop值大于400,那么设置其为固定定位,反之取消
$(function(){
//给浏览器加滚动条事件
$(window).scroll(function(){
//获得滚动上的距离
var t=$(document).scrollTop();
document.title=t;
if(t>400){
$(".p2").addClass('buyiyang')
}
else{
$(".p2").removeClass('buyiyang')
}
})
})
28
尺寸 获取内容的高度
var re=$("#news").height();
//设置内容的高度
$("#news").height(1000);//获取内容加内边距+内容的高度
var re=$("#news").innerHeight();
document.title=re;
//获取内容加总高度内边距+内容+border+外边距
var re=$("#news").outerHeight();
document.title=re;