在html中如何实现跟随页面滚动的DIV层?(具体实现步骤)
这是右边的浮动导航,像新浪微博这个这样的
body{_background-image:none; /*հҳΪ*/_background-attachment:fixed; }//这个是针对ie6的
.navi{left:51%; margin-left:474px;top:120px;position:fixed;_position: absolute;_top: expression(documentElement.scrollTop + 120 + "px"); z-index:99;}
.navi a{background-image: url(背景地址); background-repeat:no-repeat;;display: block; width:119px;}
.navi a1{background-position: 0px 0px; height:30px;}
.navi a2{background-position: 0px -30px; height:30px;}
<div class="navi" id="navi">
<a href="" class="a1" ></a>
<a href="" class="a2"></a>
<script type='text/javascript'>
(function(){
var nav= document.getElementById('navi');
var fnav= function(){
var top= document.documentElement.scrollTop||document.body.scrollTop;
if(top>500){
nav.style.display = 'block';
nav.style.marginTop="0px";
}else{
nav.style.marginTop="500"-top+"px";
}
}
window.onload =window.onscroll = fnav;
})();
</script>
</div>
width: 820,
modal: true,
title: '异常邮箱列表',
show: "slide",
open: function(){
},
buttons: {
'取消': function(){
$("#mailException_dialog").dialog( "close" );
}
}
}).dialog("open"); 调用起来如此简单