zoukankan      html  css  js  c++  java
  • 解决 IE6 position:fixed 固定定位问题!

    
    

      

    元素固定在浏览器的底部和距离右边的20个像素,这次的代码是:
    
    #top{
    position:fixed; 
    _position:absolute;
    bottom:0;
    right:20px;
    _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)));
    }
    
    right 跟 left 属性可以用绝对定位的办法解决,而 top 跟 bottom 就需要用上面的表达式来实现。其中在
    _position:absolute;
    中的
    _
    符号只有 IE6 才能识别,目的是为了区分其他浏览器。
    上面的只是一个例子,下面的才是最重要的代码片段:
    使元素固定在浏览器的顶部:
    
    使元素固定在浏览器的顶部:
    
    #top{
    _position:absolute;
    _bottom:auto;
    _top:expression(eval(document.documentElement.scrollTop));
    }
    
    使元素固定在浏览器的底部:
    
    #top{
    _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)));
    }
    

      

  • 相关阅读:
    57. Insert Interval
    287. Find the Duplicate Number
    52. N-Queens II
    51. N-Queens
    151. Reverse Words in a String
    29. Divide Two Integers
    [POJ2104]K-th Number
    [JSOI2008]最大数
    [BZOJ3673&3674]可持久化并查集&加强版
    C++ STL rope介绍----可持久化平衡树
  • 原文地址:https://www.cnblogs.com/jonhson/p/2216473.html
Copyright © 2011-2022 走看看