2

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 中运行良好。

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

4

1 回答 1

4

我在这个答案中找到了检测 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;
    }
}
于 2012-10-22T09:24:48.047 回答