-2

I wrote the code and saw a bug in firefox and little bug in chrome

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Mozila Firefox</title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script>
    $(function(){
        $(window).scroll(function(){
            if  ($(window).scrollTop() == $(document).height() - $(window).height()){
                alert('1');
            }
        });
    });
    </script>
</head>
<body>
CONTENT FOR SCROLL
</body>
</html>

When I scroll this page in firefox i getting bug which covers the black transparent background browser.

In chrome just more and more alerts.

Close your tabs in firefox! Live: http://forum.xeksec.com/habr/mozilla_crash_or_wtf/

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Isis
  • 4,608
  • 12
  • 39
  • 61
  • Not sure if it helps, but I can confirm I reproduce this bug in FF11 Your idea is to know when the scroll reach the end of the document? – haltabush Mar 19 '12 at 21:16
  • @haltabush, yea, I wanted to know when the scroo reach the end of) – Isis Mar 19 '12 at 21:23

2 Answers2

2

See https://bugzilla.mozilla.org/show_bug.cgi?id=723532

Boris Zbarsky
  • 34,758
  • 5
  • 52
  • 55
1

Edit : The above doesn't always work... In fact, I've checked some solutions around, including here in Stack Overflow. What other usually advice have the same problem (eg Alert using Jquery when Scroll to end of Page) I'm using FF11 on Ubuntu.

I think this was a performance issue. If you put your maxScroll in a variable it works (at least for me) Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Mozila Firefox</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script>
    $(function(){
        var maxScroll = $(document).height() - $(window).height();
        $(window).scroll(function(){
            if  ($(window).scrollTop()  == maxScroll){
                alert('1');
            }
        });
    });
    </script>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</body>
</html>
Community
  • 1
  • 1
haltabush
  • 4,508
  • 2
  • 24
  • 41