Add webpacker and use it for new_design

This commit is contained in:
Paul Chavard 2018-07-12 11:50:47 +02:00
parent f13056437c
commit bf7c023380
68 changed files with 8534 additions and 480 deletions

View file

@ -0,0 +1,25 @@
export function scrollMessagerie() {
const $ul = $('.messagerie ul').first();
if ($ul.length) {
const $elementToScroll = $('.date.highlighted').first();
if ($elementToScroll.length != 0) {
scrollTo($ul, $elementToScroll);
} else {
scrollToBottom($ul);
}
}
}
function scrollTo($container, $scrollTo) {
$container.scrollTop(
$scrollTo.offset().top - $container.offset().top + $container.scrollTop()
);
}
function scrollToBottom($container) {
$container.scrollTop($container.prop('scrollHeight'));
}
addEventListener('turbolinks:load', scrollMessagerie);