div在顶部不变、滚动条滚动,div还是在顶部!直接上传源码了:
方法一:
div浮层,滚动条移动,保持位置不变body{background-image:url(about:blank);background-attachment:fixed;}
#float{width:344px;height:34px;border:1px solid #C0DBF8;position:absolute;top:0px;}
dddvar IOElementById('float'),Y=IO,H=0,IE6;
IE6=window.ActiveXObject&&!window.XMLHttpRequest;
while(Y){H+=Y.offsetTop;Y=Y.offsetParent};
if(IE6)
IO.style.cssText="position:absolute;top:(this.fix?(document.documentElement.scrollTop-(this.javascript||"+H+")):0)";
window.οnscrοll=function (){
var d=document,s=Math.max(d.documentElement.scrollTop,document.body.scrollTop);
if(s>H&&IO.fix||s<=H&&!IO.fix)return;
if(!IE6)IO.style.position=IO.fix?"":"fixed";
IO.fix=!IO.fix;
};
Command("BackgroundImageCache",false,true)}catch(e){};
方法二:
居中的层
方法三:
居中的层
方法四:[采用css来居中]
function showDiv(){
}
window.οnlοad=function(){
showDiv();
}
始终在中间DIV (支持IE FF) 始终在中间本文发布于:2024-02-01 10:02:37,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170675295735858.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |