demarches-normaliennes/app/javascript/new_design/messagerie.js
2019-08-13 17:03:55 +01:00

17 lines
401 B
JavaScript

import { scrollTo, scrollToBottom } from '@utils';
export 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);