兼容ie6的元素位置fixed的方法

ie6就是神奇,css的position的fixed属性就是不支持。那怎么办呢?有一种很简单的解决方法。

body{
    background-image:url(about:blank);background-attachment:fixed;//不设置这个的话拖动滚动条屏幕会闪的。
}
.divFixed{
    position:absolute;
    bottom:auto;
    top:expression(eval(document.documentElement.scrollTop));//明显就是用js实现的
}

3 Responses to 兼容ie6的元素位置fixed的方法 »

  1. 万戈 评论 2009-09-23 22:40

    果然神奇,收藏了,以后必定有用!

    回复

    Joe 回复 九月 24th, 2009 at 10:18

    :( 要不是ie6,代码就简单多了

    回复

  2. Mr-Z 评论 2009-09-24 21:03

    虽然IE8不错,但是普及不了。

    回复

Leave a Reply

Email address is not published

You should say a Chinese word to pass spam check. If you can not input Chinese, just copy 你好 and paste them into comment text box.