demarches-normaliennes/app/javascript/new_design/messagerie.js
2018-10-10 15:05:51 +02:00

17 lines
402 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('turbolinks:load', scrollMessagerie);