我有一个 div 高度:100px 和溢出:auto
内容是动态的。
我想滚动底部的div
我尝试过
$("#chat_content").scrollTop($("#chat_content").height());
但如果内容大于 100px
$("#chat_content").height() 返回 100 并且 div 没有滚动到底部
我能怎么做?
thanks
Get the scrollHeight https://developer.mozilla.org/en/DOM/element.scrollHeight来自底层 DOM 元素的属性:
$("#chat_content").scrollTop($("#chat_content").get(0).scrollHeight);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)