直接上代码
//box-container是添加overflow的父div,也就是出现滚动条的div
var scrollTarget = document.getElementById("box-container");
//scrollTarget.scrollHeight是获取dom元素的高度,然后设置scrollTop
scrollTarget.scrollTop=scrollTarget.scrollHeight;
直接上代码
//box-container是添加overflow的父div,也就是出现滚动条的div
var scrollTarget = document.getElementById("box-container");
//scrollTarget.scrollHeight是获取dom元素的高度,然后设置scrollTop
scrollTarget.scrollTop=scrollTarget.scrollHeight;