属性
属性
attr(name|pro|key,val|fn)
removeAttr(name)
CSS类
addClass(class)
removeClass(class)
toggleClass(class) 第一次干嘛,第二次干嘛,有的去掉,没有增加
HTML代码
html(val|fn)
text(val)
text([val|fn|arr])
css
$('p').css({color:'#fff',background:'blue'});
位置madding不属于自己,padding属于自己
offset([coordinates])
position()
scrollTop([val])
尺寸
heigth(【val|fn】)
滑轮到顶部
<style>
.hide{
display:none;
}
</style>
<script>
$(function(){
$(window).scroll(function(){
var top=$(this).scroolTop();
if (top>100){
$('#gotop').remvoeClass('hide');
}else{
$('#gotop').addClass('hide');
}
});
$('#gotop').click(function(){
$(window).scroolTop(0);
});
})
</script>
<body>
<div id='gotop' style='position:fixed;right:10px;buttom:30px;cursor:pointer' class='hide'> 返回顶部</div>
<div style='height:900px;'></dv>
</body>
浙公网安备 33010602011771号