Jquery and chrome weird thing...

Jquery and chrome weird thing...

Ok well I've been trying to resolve this for days with no avail, worst thing is looking at the code there shouldn't be a problem, chrome just seems to find one.I'm using the code :

  1.     if($("#chatscreen")[0].scrollHeight - $("#chatscreen").scrollTop() == $("#chatscreen").outerHeight())
       
    {
       
          alert("work");
       
    }
to check if a div's scroll is at the bottom of the page and it works fine for firefox and internet explorer but not chrome.

When I use this other code




  1. $("#chatscreen").scroll(function(){
       
    if($(this)[0].scrollHeight - $(this).scrollTop() == $(this).outerHeight())
       
    {
        alert
    ("work");
       
    }
    });​
All three browsers, firefox, internet explorer and chrome work except I don't like this code because the way it works is too buggy and it because gets the browser not to respond.



What I don't really get is why doesn't the first code work in chrome? I mean the only difference is
  1. $("#chatscreen").scroll(function(){

which shouldn't really be that big of a thing should it??Anyway I'm
trying to find some kind of work arround to get this to work on all three browsers.

Would really appreciate any help/advice and if possible some kind of explanation as to is
this a bug or am I just using jquery in a wrong way.

Thank you