$(window).scroll(function() not working on firefox?

I have the same problem: it works in chrome but not in firefox and IE. After debugging i found that there is a 1 px difference between $(document).height() - $(window).height() and $(window).scrollTop() in firefox but not in chrome. My working solution here:

    if  ($(window).scrollTop() + 1 >= $(document).height() - $(window).height()){

      //do something here

    }

I know this is an really old article, but i was struggling with this today. I was trying to active an counter when it came into my viewport. It stopped working after i added some style to my style.css.

  html { 
    scroll-behaviour: smooth
  }

So, may this be in you favour, adding this will cause $(window).scroll function stop working on firefox and IE.


The scroll event is firing so many times that your Firefox browser is crashing. Instead of using alert(), use console.log()...

Here is a demo to show how many events are fired: http://jsfiddle.net/jasper/tQmRU/

Tags:

Firefox

Jquery