1

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");
});
André Dion
  • 19,231
  • 7
  • 52
  • 59

1 Answers1

1

Try with this..

$('.arrow-up').click(function(){
    $('html, body').animate({scrollTop : 0},300);
    return false;
});
Parvez Rahaman
  • 3,659
  • 2
  • 18
  • 34