最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ie6中pisition:fixed不起作用,浮窗不随屏滚动解决办法
时间:2022-06-25 11:18:49 编辑:袖梨 来源:一聚教程网
按网上的说明,下面的这段css中的_top好像起不到作用.
| 代码如下 | 复制代码 |
|
.jumpbox{ _top: expression(eval(document.compatMode && |
|
后来百度了一下
加上个属性
| 代码如下 | 复制代码 |
| _top:expression(eval(document.documentElement.scrollTop)); | |
就OK了!
利用IE特殊支持的CSS表达式以及position:absolute完美解决这个BUG。。
PS.以上方法还需要在html加入如下属性:
| 代码如下 | 复制代码 |
|
background-image:url(about:blank); |
|
最后我们再来整理一下
1、ie6下 position:fixed 设置
#bot-fixed{position:fixed;_postion:absolute;bottom:0;_bottom:auto;right:20px;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
2、元素固定在浏览器的顶部和底部设置方法(针对IE6)
A:元素固定在浏览器的顶部:
| 代码如下 | 复制代码 |
|
#bot-fixed{_position:absolute;_bottom:auto;_top:expression(eval(document.documentElement.scrollTop));} |
|
B:元素固定在浏览器的底部:
| 代码如下 | 复制代码 |
|
#bot-fixed{_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)));} |
|
3、解决position:fixed 层闪烁 的方法
在css样式表中添加
| 代码如下 | 复制代码 |
| *html{ background-image:url(about:blank); background-attachment:fixed; } | |
属性
我们也可以使用js来解决些问题了
| 代码如下 | 复制代码 |
|
g1 = (getClientHeight() – o.height) / 2;//1000px总 元素高300px 则 g1=350px }) } |
|
相关文章
- 洛克王国世界妮蔓在哪里 妮蔓具体位置 10-20
- 鸣潮卜灵什么时候上线 卜灵上线时间预测 10-20
- 鸣潮千咲什么时候上线 千咲上线时间一览 10-20
- 鸣潮千咲是什么属性 千咲属性介绍一览 10-20
- 洛克王国世界拾遗任务怎么做 拾遗任务攻略一览 10-20
- 荒野起源木材怎么获得 木材获取攻略 10-20