2010-08-24 53 views
1

在此站點http://church.allthingswebdesign.com/Contact-Us.php上,左側的鏈接在除IE以外的每個瀏覽器中均正常工作。在IE7中我看到有JavaScript錯誤,但我無法弄清楚錯誤會是什麼。IE7中的jQuery錯誤

以下是在此頁面上執行的jQuery代碼片段。

誰能告訴我爲什麼我在IE7中看到javascript錯誤?

//slides the left sidebar links when the button is clicked 
    $('div.links').hide(); 
    $('div.boxes h3 a.button').click(function(e) { 

    var $links = $(this).parents('div.boxes'); 

    $(this).parents().children('div.links').slideDown(500); 
    $links.slideDown(500).animate({ 

     //if the left property = 0, move it to the left as many pixels as it is wide, 
     //else move it back to 0 
     left: parseInt($links.position().left,10) == 0 ? (-$links.outerWidth()-2) : 0 
    }, 500); 

    e.preventDefault(); 
}) 

//scrolls the upcoming events 
function scroll() { 
    $('#events ol li:first').slideUp(function(){ 
     $last = $(this).appendTo($(this).parent()).show().css('borderBottom', 'solid 1px #d1d3dc;'); 
     $last.prev().css('borderBottom', 'solid 1px #d1d3dc'); 
     $('#events ol li:last').css('borderBottom', 'none'); 

    }); 
} 
+0

當IE7拋出一個錯誤,它給當你點擊它,什麼是實際的錯誤的描述?這是有原因:) – 2010-08-24 01:24:46

+0

也關閉兩個「禁用腳本調試」選項,並且「顯示友好的錯誤消息」這將提供更好的調試信息。這些是在Internet Explorer的高級選項。 – balupton 2010-08-24 01:27:41

+0

@Catfish - 錯誤與您的事件滾動器有關。去你的網站,不要碰任何東西,你會在3秒內收到一個JS錯誤(關於你的事件想要滾動的時間)。我會從那裏開始。 – Tommy 2010-08-24 01:28:06

回答

2

不知道這將修復它,但他們是一個良好的開端:

  1. 把它通過JSLint的。
  2. 刪除您的CSS值內的分號。
  3. 緩存$(本),爲提高速度的局部變量var $this = $(this);
+0

這是這行中的分號 $ last = $(this).appendTo($(this).parent())。show().css('borderBottom','solid 1px#d1d3dc;'); – Catfish 2010-08-24 01:37:35