17 lines
419 B
JavaScript
17 lines
419 B
JavaScript
window.scrollToBottom = (element) => {
|
|
if (element) {
|
|
requestAnimationFrame(function () {
|
|
element.scroll({ top: element.scrollHeight, behavior: 'smooth' });
|
|
})
|
|
}
|
|
};
|
|
|
|
window.getScrollInfo = (element) => {
|
|
if (!element) return null;
|
|
return {
|
|
scrollTop: element.scrollTop,
|
|
scrollHeight: element.scrollHeight,
|
|
clientHeight: element.clientHeight
|
|
};
|
|
};
|