[英]Auto-Scroll in FireFox
My application is a Live chat. 我的应用程序是实时聊天。 I have a Div to wrap the messages, each message is a div, so, after a few messages my DOM looks like this :
我有一个Div来包装消息,每个消息都是一个div,所以,在几条消息后我的DOM看起来像这样:
<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 a need to auto-scrool the divChatHistory for each message, and its realy simple: 现在需要为每条消息自动scrool divChatHistory,它真的很简单:
function AutoScroll() {
$('#<%= divChatHistory.ClientID%>').scrollTop(100000000000);
}
but it works only in Internet Explorer (IE) in FireFox (FF) not happens. 但它只适用于FireFox(FF)中的Internet Explorer(IE)不会发生。
Any Idea ? 任何的想法 ?
Solved. 解决了。
function AutoScroll() {
if (chkRolagem[0].checked) {
if (jQuery.browser.msie)
divChatHistory.scrollTop(100000000000);
else
divChatHistory.scrollTop(-100000000000);
}
}
If IE, positive number. 如果IE,正数。
If FF, negative number 如果FF,负数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.