Pixastic“blend”过滤器似乎在IE9的演示站点上运行良好,但实际的可下载代码却没有。我相信这是由于第426行pixastic.core.js文件中的“isIE”检测代码所致:
isIE : function() {
return !!document.all && !!window.attachEvent && !window.opera;
}
每当调用Pixastic.Client.isIE()时,它都会通过该测试获取IE9。如果我在204行开始注释掉块
if (imageIsCanvas && Pixastic.Client.isIE()) {
Blend效果在IE9中运行良好。
是否有一个片段我可以替换上面显示的“ieIE”函数,以便在允许IE9的同时保持旧版本的IE远离效果?或者,如果我检测错误,它在哪里以及如何修改它以适应?非常感谢。
答案 0 :(得分: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;
}
}