代码之家  ›  专栏  ›  技术社区  ›  Catfish

在Safari和chrome中,链接需要2次点击,但在Firefox中只需要1次

  •  0
  • Catfish  · 技术社区  · 14 年前

    我在这个网站工作 http://church.allthingswebdesign.com

    以下是我的jQuery:

    //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 css property = 0, move it to the left as many pixels as it is wide,
            //else move it back to 0
            left: parseInt($links.css('left'),10) == 0 ? (-$links.outerWidth()-2) : 0
        }, 500);
    
        e.preventDefault();
    })
    

    另外,当你点击左边的链接时,如何使灯光颜色不可见?

    1 回复  |  直到 14 年前
        1
  •  1
  •   user113716    14 年前

    我很确定Safari有默认值 left auto 而FF以像素为单位给出一个位置。

    尝试测试 $links.css('left') . 我敢打赌就是这样。

    在CSS或javascript中 div.boxes 0 或者别的什么,看看能不能帮上忙。

    或者代替

    $links.css('left')
    

    $links.position().left;