IE7中的jQuery错误

时间:2010-08-24 01:22:28

标签: jquery

在此网站http://church.allthingswebdesign.com/Contact-Us.php上,左边的链接在除IE之外的每个浏览器中都能正常工作。在IE7中,我看到有javascript错误,但我无法弄清楚错误是什么。

以下是在此页面上执行的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');

    });
}

1 个答案:

答案 0 :(得分:2)

不确定这些是否可以修复它,但它们是一个良好的开端:

  1. 通过JSLint。
  2. 删除css值中的分号。
  3. 将$(this)缓存到本地变量以提高速度var $this = $(this);
相关问题