var autoheight=document.body.scrollTop||document.documentElement.scrollTop
if(autoheight>76){
$("#index-left").css("position","fixed")
$("#index-left").css("top",0)
$("#index-left").css("left",0)
}
else{
$("#index-left").css("position","absolute")
}
}你那个有兼容 我这个是我线上使用的
将底部的内容定位到顶部,只要在css层上面加上一个浮动,将定位至top设置成0即可。说明如下:
position:absolute(将对象浮动)
top:0(将对象定位对顶部)
整体css示范如下:
<div style="position:absolute top:0 width:100% height:50px background:#000 color:#FFF text-align:center">内容顶部</div>如要将内容放至底部,只需将top:0修改成bottom:0即可,整体css未范如下:
<div style="position:absolute bottom:0 width:100% height:50px background:#000 color:#FFF text-align:center">内容底部</div>希望我的回答能令你满意!