Add webpacker and use it for new_design
This commit is contained in:
parent
f13056437c
commit
bf7c023380
68 changed files with 8534 additions and 480 deletions
25
app/javascript/new_design/messagerie.js
Normal file
25
app/javascript/new_design/messagerie.js
Normal 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);
|
Loading…
Add table
Add a link
Reference in a new issue