Enabled treeview with turbo frames.

This commit is contained in:
Jan Böhmer 2022-03-05 23:09:55 +01:00
parent 7b244d3034
commit 41e0b251a9
5 changed files with 211 additions and 17 deletions

27
assets/js/events_base.js Normal file
View file

@ -0,0 +1,27 @@
function registerLoadHandler(fn) {
document.documentElement.addEventListener('turbo:load', fn);
}
registerLoadHandler(function() {
/**
* Register the button, to jump to the top of the page.
*/
$(document).on("ajaxUI:start", function registerJumpToTop() {
$(window).scroll(function () {
if ($(this).scrollTop() > 50) {
$('#back-to-top').fadeIn();
} else {
$('#back-to-top').fadeOut();
}
});
// scroll body to 0px on click
$('#back-to-top').click(function () {
$('#back-to-top').tooltip('hide');
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
}).tooltip();
});
})