再说 IE6 的背景闪烁

2008.01.0409:42

基本上 google 一下 IE6 flicker,第一页基本全是说这个问题,解决方法就是那个神奇的 document.execCommand("BackgroundImageCache",false,true),只不过是围绕着用 CSS expression 还是 JavaScript 的问题。JavsScript 最稳妥,不过有时候 JavaScript 未必方便改,而 CSS 虽然方便但是 expression 会反复执行,有严重的效率问题。最近的几个项目用的方法是这样的,在 expression 中把 CSS 中用来触发的属性重写一下:

body{
    zoom: expression(function(ele){
    document.execCommand('BackgroundImageCache', false, true);
    ele.style.zoom = '1';
    }(this));
}

这里用 zoom 触发,搞定之后把 zoom 写回 1(好像我很喜欢捣腾 zoom),这下就没效率问题了吧,嘿嘿。同理,其他针对 IE 的 hack,如果是只跑一次的 expression,其实都可以这样做,所谓兔死狗烹过河拆桥是也~ :D。

3 Comments Comment RSS »

The URI to TrackBack this entry is: http://old9.blogsome.com/2008/01/04/ie6-background-flicker-expression-override/trackback/

  1. 一直习惯了都是javascript的方式
    …这样看起来我做每个项目都用了javascript

    Comment by fireyy — 2008.1.04 @ 11:15

  2. 娃~你还在这里写~干脆换个自己的吧~

    Comment by aoao — 2008.1.04 @ 14:43

  3. 懒得折腾了,自娱自乐,嘿嘿~

    Comment by old9 — 2008.1.04 @ 15:33

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


为防评论机器人,劳驾您输入图片中的字符 :)
captcha