2013-11-26 115 views
0

我有以下的jQuery代碼:導航不工作的IE8

$(function() { 
    $('ul.step-navigation li a').bind('click',function(event){ 
     var $anchor = $(this); 
     $('html, body').stop().animate({ 
      scrollTop: $($anchor.attr('href')).offset().top 
     }, 1500,'easeInOutExpo'); 
     event.preventDefault(); 
    }); 
}); 

它是用來通過頂部導航導航到不同的部分頁面上。它可以在FireFox,Chrome,IE9 +上運行100%,但不會在IE8上運行。

這裏的一些答案建議刪除寬鬆,例如這一個:Trouble implementing Smooth Vertical scrolling with jQuery但它不適用於我的情況。

請幫助,如果你能看到爲什麼這不起作用在IE8?它只是忽略點擊事件。

回答

0

經過大量的研究,我發現這個:background is not support in ie8 only?之後,在使用<section>標籤時,在關於IE8背景的另一個問題上掙扎後,當我包含modernizr時,它也解決了導航問題。

據我所知,IE8不支持HTML5元素,如<section>元素,這就是爲什麼背景現在可以工作,但我不確定爲什麼它解決了導航問題。