I've build a website for my resume with jQuery for some scroll-based events and animations. The problem is the "Go to top" arrow works fine on Chrome (PC) and Mobile Safari but doesn't seem to work on Firefox.
//arrow up show/hide function
$(document).on("scroll", function(){
    "use strict";
    if($(document).scrollTop() > 500){
        $(".arrow-up").addClass("arrow-up-clicked");
    } else {
        $(".arrow-up").removeClass("arrow-up-clicked");
    }
});
//arrow up on click event
$(".arrow-up").on("click", function() {
    "use strict";
    $("body").animate({
        scrollTop: 0
    }, "300", "swing");
});
 
     
    