Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 转到顶部平滑滚动按钮';不能在OSX上的Firefox中工作_Jquery_Html_Firefox_Smooth Scrolling - Fatal编程技术网

Jquery 转到顶部平滑滚动按钮';不能在OSX上的Firefox中工作

Jquery 转到顶部平滑滚动按钮';不能在OSX上的Firefox中工作,jquery,html,firefox,smooth-scrolling,Jquery,Html,Firefox,Smooth Scrolling,我一直在这个网站上工作: 除了Firefox,右边的红色图标在所有浏览器中都能正常工作,我不知道为什么 代码如下: <body id="gototop"> <nav> <p><a href="../about.html" class="nav_about p_about">About</a></p> <a href="../buchstudio.html" class="nav_logo"><h5>

我一直在这个网站上工作:

除了Firefox,右边的红色图标在所有浏览器中都能正常工作,我不知道为什么

代码如下:

<body id="gototop">
<nav>
<p><a href="../about.html" class="nav_about p_about">About</a></p>
<a href="../buchstudio.html" class="nav_logo"><h5>B</h5></a>
<a href="#gototop"><img class="nav_gototop" src="../img/gototop.png" alt="Go to top"></a>
</nav>

$(document).ready(function() {
    $('a[href^="#"]').on('click',function (e) {
        e.preventDefault();
        console.log("Denne funktion fanger #");
        console.log(event);

        var target = this.hash,
        $target = $(target);

        $('html, body').stop().animate({
            'scrollTop': $target.offset().top
        }, 800, 'swing', function () {
            window.location.hash = target;
        });
    });
});

$(文档).ready(函数(){ $('a[href^=“#“]”)。关于('click',函数(e){ e、 预防默认值(); console.log(“Denne funktion fanger#”); console.log(事件); var target=this.hash, $target=$(target); $('html,body').stop().animate({ 'scrollTop':$target.offset().top },800,'swing',函数(){ window.location.hash=目标; }); }); });
谢谢


(我正在OSX中测试)

请参阅前面的帖子:试试这个David:它成功了!谢谢:-)