【问题标题】:Pixastic IE test kills IE9Pixastic IE 测试杀死 IE9
【发布时间】:2011-10-30 23:52:23
【问题描述】:

Pixastic“混合”过滤器似乎在他们的 IE9 演示站点上运行良好,但实际可下载的代码却不能。我相信这是由于 pixastic.core.js 文件第 426 行中的“isIE”检测代码:

isIE : function() {
  return !!document.all && !!window.attachEvent && !window.opera;
}

每当调用 Pixastic.Client.isIE() 时,它都会通过该测试选择 IE9。如果我注释掉第 204 行开始的块

if (imageIsCanvas && Pixastic.Client.isIE()) {

混合效果在 IE9 中运行良好。

是否有一个 sn-p 可以替换上面显示的“ieIE”功能,以使旧版本的 IE 在允许 IE9 的同时远离效果?或者,如果我的检测错误,它在哪里以及如何修改它以适应?非常感谢。

【问题讨论】:

    标签: jquery internet-explorer-9 pixastic


    【解决方案1】:

    我在这个答案中找到了检测 ie9 解决方案的帮助: Internet Explorer 9 Object Detection

    使用以下代码片段更改“isIE”函数对我有用。不是很清楚的解决方案,但是解决了问题:

    isIE : function() {
        var ie = (function(){
            var undef,
            v = 3,
            div = document.createElement('div'),
            all = div.getElementsByTagName('i');
    
            while (
                    div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
                    all[0]
            );
    
            return v > 4 ? v : undef;
    
        }());
    
        if (ie >= 9) {
            return false;
        } else {
            return !!document.all && !!window.attachEvent && !window.opera;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-27
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多