Added back-to-top button
All checks were successful
the build was successful

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2018-11-24 15:19:51 +01:00
parent 91a950d7ad
commit ba42af74a8
4 changed files with 33 additions and 1 deletions

View File

@ -10,6 +10,14 @@
border-bottom: 2px solid $light;
}
#back-to-top {
cursor: pointer;
position: fixed;
bottom: 20px;
right: 20px;
display:none;
}
$navbarHeight: 58px;
.large {

View File

@ -11,4 +11,22 @@ $(function() {
mainMenu.on('hidden.bs.collapse', function (e) {
$('#submenuNavbar').removeClass('invisible');
});
let backToTop = $('#back-to-top');
$(window).scroll(function () {
if ($(this).scrollTop() > 50) {
backToTop.fadeIn();
} else {
backToTop.fadeOut();
}
});
backToTop.click(function() {
backToTop.tooltip('hide');
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
backToTop.tooltip();
});