<div style="height:2000px">
<div id="dialog" title="Dialog Title" style="border:1px solid blue;width:300px;height:20px;background-color: yellow">I'm a dialog</div>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" >
var cur_window_width=document.documentElement.clientWidth;
var cur_window_height=window.innerHeight||document.documentElement.clientHeight;// or just use jquery innerHeight()
var t_d_w=$("#dialog").width();
var t_d_h=$("#dialog").height();
$("#dialog").css("position","absolute");
$("#dialog").css("z-index","1");
$("#dialog").css("left",(cur_window_width/2-t_d_w/2));
$("#dialog").css("top",(cur_window_height/2-t_d_h/2));
var div = $("#dialog")[0];
var y = parseInt(div.style.top);
setInterval(function(){
var cy = parseInt(div.style.top);
var dy = document.body.scrollTop || document.documentElement.scrollTop;
div.style.top = (cy + (dy -(cy-y))*0.1) + "px"; // 0.1 为 滑动幅度
//或者如下
div.style.top = ( dy + y ) + "px";
},1);
</script>
</div>
<div id="dialog" title="Dialog Title" style="border:1px solid blue;width:300px;height:20px;background-color: yellow">I'm a dialog</div>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" >
var cur_window_width=document.documentElement.clientWidth;
var cur_window_height=window.innerHeight||document.documentElement.clientHeight;// or just use jquery innerHeight()
var t_d_w=$("#dialog").width();
var t_d_h=$("#dialog").height();
$("#dialog").css("position","absolute");
$("#dialog").css("z-index","1");
$("#dialog").css("left",(cur_window_width/2-t_d_w/2));
$("#dialog").css("top",(cur_window_height/2-t_d_h/2));
var div = $("#dialog")[0];
var y = parseInt(div.style.top);
setInterval(function(){
var cy = parseInt(div.style.top);
var dy = document.body.scrollTop || document.documentElement.scrollTop;
div.style.top = (cy + (dy -(cy-y))*0.1) + "px"; // 0.1 为 滑动幅度
//或者如下
div.style.top = ( dy + y ) + "px";
},1);
</script>
</div>