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)));
    }
    

      

  • 相关阅读:
    Leetcode Binary Tree Paths
    Leetcode Lowest Common Ancestor of a Binary Tree
    Leetcode Lowest Common Ancestor of a Binary Search Tree
    Leetcode Path Sum
    Leetcode Symmetric Tree
    Leetcode Invert Binary Tree
    Leetcode Same Tree
    Leetcode Maximum Depth of Binary Tree
    Python Json&Pickle&模块
    Python Shelve模块
  • 原文地址:https://www.cnblogs.com/jonhson/p/2216473.html
Copyright © 2011-2022 走看看