手头一个项目中,要实现把一个浮层控制在浏览器窗口右下角,用”position:fixed”来控制最合适不过了。

但万恶的IE6不支持这个属性,之前采用过的方法有:将滚动条转移到body上,使用绝对定位控制浮层位置;使用JS实时判断滚动并设置浮层位置。

第一种方法局限性太大,页面中有其他绝对定位元素会受到影响;第二种方法需要在页面里加定时器,资源开销和时间成本都有点高。

后来在同事小卓的启发下,使用CSS表达式完成了IE6的兼容,代码如下:

_position:absolute;
_top:expression(document.documentElement.clientHeight - 213 + (e=document.documentElement.scrollTop) +'px');
/*
document.documentElement.clientHeight : 浏览器串口高度
200 : 浮层高度
(e=document.documentElement.scrollTop) : 滚动条高度
 */
 

IE6的position:fixed的更多相关文章

  1. 让IE6兼容position:fixed

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. IE6下position:fixed;兼容

    *html{ background-image:url(about:blank); background-attachment:fixed;}/*解决抖动问题*/ .backto-top{ width ...

  3. IE6中position:fixed无效问题解决

    在做页面右下脚对话框时,直接使用position:fixed;大部分浏览器很容易就能做到,但是在IE6中却发现不行,原来是IE6不支持position:fixed;这个属性. 虽然用JS肯定能解决这个 ...

  4. IE6下position:fixed不支持问题及其解决方式

    IE6有诸多奇葩,不支持position:fixed就是当中之中的一个.所以在做一些比方固定在顶部或者底部或者固定元素的效果时须要考虑兼容IE6的这个问题.解决方式是用Ie6的hack. *html ...

  5. 让IE6支持position:fixed的方法,CSS expression与JavaScript eval讲解

    做吸顶效果或是固定效果时,使用position:fixed无非是最方便的,可是万恶的IE6是没有fixed这个属性值的,而我们要使IE6能够像fixed一样固定在浏览器中的某个位置,使用onscrol ...

  6. 打造IE6的position:fixed整理篇

    fixed真的是一个很好的属性.特别是做弹层的时候.可惜的是“国内主流浏览器”IE6大大不支持. 一般的我们都会通过CSS中的表达式来解决这个问题. .fixed { position:absolut ...

  7. ie6下position:fixed定位问题

    1. *html{ background-image:url(about:blank); background-attachment:fixed;}2.将需要用固定定位的元素中加上_position: ...

  8. 完美解决IE6不支持position:fixed的bug

    示例代码: <!DOCTYPE html><html><head><meta http-equiv="Content-Type" cont ...

  9. js完美解决IE6不支持position:fixed的bug

    详细内容请点击 <!DOCTYPE html><html><head><meta http-equiv="Content-Type" co ...

随机推荐

  1. [Angular2 Router] Lazy Load Angular 2 Modules with the Router

    Angular 2 lazy loading is a core feature of Angular 2. Lazy loading allows your application to start ...

  2. vs开发工具之--自动生成注释

    GhostDoc是Visual Studio的一个免费插件,轻松一个快捷键CTRL+SHIFT+D就能够帮助自动生成注释 下载地址:http://submain.com/download/ghostd ...

  3. 20 Free Open Source Web Media Player Apps

    free Media Players (Free MP3, Video, and Music Player ...) are cool because they let web developers ...

  4. 特殊IP地址

    主机ID全为0:不分配给任何主机,仅用于表示某个网络的网络地址. 主机ID全为1:不分配给任何主机,仅用做广播地址. IP地址的32位全为1:即255.255.255.255,为有限广播地址(http ...

  5. redis的实现过程

    1下载redis的安装包并按照操作安装 2开启 右击我的电脑→管理→服务→站到redis service服务 将其开启 注意:redis服务开启后其默认的ip和端口号为127.0.0.1:6379 3 ...

  6. Disruptor 源码阅读笔记--转

    原文地址:http://coderbee.net/index.php/open-source/20130812/400 一.Disruptor 是什么? Disruptor 是一个高性能异步处理框架, ...

  7. Hastiness

    Problem Description How many problems did you AC?When you read this problem, don’t hasty and careles ...

  8. myecplise 打开报错 Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project 'myf'. Java.lang.NullPointerException

    Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project 'myf'.Java.l ...

  9. OC 实现的几个排序算法

    和在VC++6.0里相比 在OC里面实现 不算困难 可是我用惯了C/C++呢 快速排序,冒泡排序,直接插入排序和折半插入排序,希尔排序,堆排序,直接选择排序 /******************** ...

  10. ios 画圆环进度条

    #import <UIKit/UIKit.h> @interface SNCircleProgressView : UIView /** * 进度值0-1.0之间 */ @property ...