Jquery onclick scrolltop speed not changing/delays the animation instead

29 Views Asked by At

I have function that scrolls the page back to the top when clicked:

$('.back-to-top').on('click', function(){
        $("html").animate({ scrollTop: 0 },300);
    });

The function is working correctly but for some unknown reason, the speed variable (300) does not change the speed but delays the animation instead.

I don't see any speed change when I set it to $("html").animate({ scrollTop: 0 },0); versus $("html").animate({ scrollTop: 0 },300), and $("html").animate({ scrollTop: 0 },3000) significantly slowed down the animation,,,

Does anyone know the issue? Thank you!

0

There are 0 best solutions below