You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
matrix-chat/src/lib/scrollHandler.js

14 lines
373 B
JavaScript

export default class {
constructor(element) {
this.element = element
}
scrollToBottom(){
this.setScrollBottom(0);
}
getScrollBottom(){
return this.element.scrollHeight - this.element.scrollTop - this.element.offsetHeight;
}
setScrollBottom(height){
this.element.scrollTop = this.element.scrollHeight - this.element.offsetHeight - height;
}
}