demarches-normaliennes/app/javascript/new_design/messagerie.js
2020-10-07 11:39:57 +02:00

17 lines
394 B
JavaScript

import { scrollTo, scrollToBottom } from '@utils';
function scrollMessagerie() {
const ul = document.querySelector('.messagerie ul');
if (ul) {
const elementToScroll = document.querySelector('.date.highlighted');
if (elementToScroll) {
scrollTo(ul, elementToScroll);
} else {
scrollToBottom(ul);
}
}
}
addEventListener('ds:page:update', scrollMessagerie);