Auto scrolling in FireFox

My application is chat. I have a div for wrapping messages, each message is a div, so after a few posts my DOM looks like this:

<div id = "divChatHistory">
   <div id = "msg1> Message number one </div>
   <div id = "msg2> Message number two </div>
   <div id = "msg3> Message number three </div>
   // ...
</div>

Now you need an auto-scrool divChatHistory for each message, and its really simple:

function AutoScroll() {
    $('#<%= divChatHistory.ClientID%>').scrollTop(100000000000);
}

but it only works in Internet Explorer (IE) in FireFox (FF) does not occur.

Any idea?

+4
source share
2 answers

solvable.

 function AutoScroll() {
    if (chkRolagem[0].checked) {
        if (jQuery.browser.msie)
            divChatHistory.scrollTop(100000000000);
        else
            divChatHistory.scrollTop(-100000000000);
    }
}

If IE, a positive number.

If FF, negative number

+3
source

You can use the scrollTo plugin . See demo

Check it out also

Animated scrolling with jQuery 1.2

+1
source

All Articles