.DIV名称{
height: 92px;
width: 100%;
position: fixed;
top: 0;
_position: absolute;
_bottom: auto;
_top:expression(eval(document.documentElement.scrollTop));
}
这个是头部悬停的CSS样式。极其简单的纯CSS样式就可以做到的效果,无须用JS、JQ等。之前自己没找到方法的时候也是极其苦恼(因为我也是在网上搜索自己想要的答案,没有具体的步奏、或者根本解决不了)
如果想要是底部悬停,则更换一段代码即可。
.DIV名称{
height: 92px;
width: 100%;
position: fixed;
top: 0;
_position: absolute;
_bottom: auto;
_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));
}