polyglot/app/javascript/packs/scroll.js

11 lines
264 B
JavaScript
Raw Permalink Normal View History

2018-09-06 00:59:16 +00:00
function scrollLastMessageIntoView() {
const messages = document.querySelectorAll('.message');
const lastMessage = messages[messages.length - 1];
if (lastMessage !== undefined) {
lastMessage.scrollIntoView();
}
}
export { scrollLastMessageIntoView }