ie6中的position:fixed定位兼容性寫法分享

字號:


    非ie6下的寫法大家一般都清楚如何寫;這里就不展示了;
    切入正題,以下的ie6下css的兼容性寫法:
    代碼如下:
    /* 修正ie6振動bug */
    html,* html body{background-image:url(about:blank);background-attachment:fixed;}
    /* ie6 頭部固定 */
    html .fixed-top{position:absolute;bottom:auto;top:expression(eval(document.documentelement.scrolltop));}
    /* ie6 右側(cè)固定 */
    html .fixed-right{position:absolute;right:auto;left:expression(eval(document.documentelement.scrollleft+document.documentelement.clientwidth-this.offsetwidth)-(parseint(this.currentstyle.marginleft,10)||0)-(parseint(this.currentstyle.marginright,10)||0));}
    /* ie6 底部固定 */
    html .fixed-bottom{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)));}
    /* ie6 左側(cè)固定 */
    * html .fixed-left{position:absolute;right:auto;left:expression(eval(document.documentelement.scrollleft));}