Part-DB.Part-DB-server/assets/js/events_base.js
2022-03-05 23:09:55 +01:00

27 lines
No EOL
775 B
JavaScript

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();
});
})