0

I know, this question have been asked for hundred times but none of the solutions did help me actually.

Scroll Top does not work on firefox but it does in chrome and safari.

here my js

function scroll_top (){
  $("body").append("<div id='scroll-top'><i class='fa fa-angle-up'></i></div>")
  $('#scroll-top').on( 'click', function() {
      $('html, body').animate({scrollTop: 0});
      return false;
  });
  if( $(window).scrollTop() > 700 ) {
    $('#scroll-top').fadeIn();

  } else {

    $('#scroll-top').fadeOut();
  }

  $(window).scroll(function(){
    if( $(window).scrollTop() > 700 ) {
      $('#scroll-top').fadeIn();
    } else {
      $('#scroll-top').fadeOut();
    } 
  })

}

and my html

html, body {
    width: 100%;
    min-height: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);

}

thank you in advance.

Ianis
  • 1,170
  • 6
  • 12
Anar Bayramov
  • 8,669
  • 4
  • 37
  • 60

1 Answers1

0

The command $('html, body').animate({scrollTop: 0}); does not work on your website in Firefox. There are some problems in Firefox, which were already discussed intensively on stackoverflow.

To fix your problem in Firefox, you need to set some CSS properties to <html> and <body> according to the following answer. Then, it works. https://stackoverflow.com/a/8149216

Community
  • 1
  • 1
ssc-hrep3
  • 10,806
  • 4
  • 35
  • 77