滚动方法不起作用 [英] scrolltop method not working
本文介绍了滚动方法不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用javascript的scrolltop方法在我的聊天室应用程序中的div底部滚动,但它仅在IE中有效,不适用于更高版本的浏览器.
请为我提供解决方案
i am using the scrolltop method of javascript to scroll at the bottom of the div in my chatroom application but it is working only in IE & not for the higher version browsers.
please provide me the solution
推荐答案
try it :
<pre lang="Javascript">
var doc = document.documentElement || document;
doc.scrollTop = 100;
</pre>
for div elements:
<pre lang="HTML">
document.getElementById("TheDivId").scrollTop = 100;
</pre>
I've tested it, it works.
这篇关于滚动方法不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文