2013-11-23 79 views
0

我的網站在一個月左右的時間裏工作得很好,然後微軟把它全部的榮耀都強制了我的IE更新,現在我的條件註釋被ie10忽略了。強制IE10忽略javascript

以前我有這個:

<!--[if !IE]><!--><script type="text/javascript" src="slideshow.js"></script><!--<![endif]--> 

這是工作的罰款,沒有人知道的一種方式,迫使IE10忽略上面的腳本?

按照這裏要求的完整的腳本我需要阻止IE加載,否則如果有人知道如何得到這個工作在IE和Webkit瀏覽器,我很想看到它。

var Each = function(array, callback){ 
    for(var i = 0; i < array.length; ++i){ 
    callback.apply(array, [array[i], i, array]); 
    } 
}; 
var hideAll = function(elements) { 
    Each(elements, function(img){ 
     img.className = 'hide'; 
    }); 
}; 
var flipImages = document.querySelectorAll('.images-flip img'); 
hideAll(flipImages); 
var Counter = function(init, cb, t){ 
    this.start = function(){ 
     init.call(this); 
     this.loop(); 
    }; 
    this.callback = cb; 
    this.loop = function(){ 
     clearTimeout(this.timeout); 
     this.timeout = setTimeout(this.loop.bind(this), t); 
     this.callback.call(this); 
    }; 
    this.stop = function(){ 
     clearTimeout(this.timeout); 
    }; 
    return this; 
}; 
var flipArray = document.querySelectorAll('.images-flip'); 
Each(flipArray, function(flip){ 
    flip.counter = new Counter(function(){ 
     this.count = 0; 
     }, 
     /*loop*/ function(){ 
     hideAll(flip.children); 
     flip.children[this.count].className = ''; 
     this.count = (this.count+1) % flip.children.length;   
     }, 
    flip.dataset.time); 
    flip.counter.start(); 
}); 
+0

看來你忘了添加示例代碼。 –

+1

IE10禁用了對條件註釋的支持。而不是問如何爲IE禁用它,IE10不支持什麼打破腳本? –

+0

爲什麼'如果不是IE10'加載你的腳本,否則不是。 – marekful

回答

1

http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx

結帳一次,這個鏈接。希望這可以幫助。

+0

是的,但然後你堅持渲染頁面,就好像它是IE9! :(功能檢測是唯一的方法... – zamnuts

+0

否則,您可能需要將slideshow.js代碼放入此循環中 if(!$。browser.msie){} –

+0

感謝Murali,那是一種享受。很高興微軟現在實際上已經承認,人們不得不修改他們的網站以使用IE瀏覽器,希望將來他們會讓它們更加兼容 – JJmason