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

View File

@ -33,6 +33,11 @@
</div>
</div>
</div>
<button id="back-to-top"
class="btn btn-primary btn-lg"
title="Click to return to the start of the page" data-toggle="tooltip" data-placement="left">
<span class="fas fa-chevron-square-up"></span>
</button>
</div>
{% include footer.html %}
</body>

View File

@ -24,7 +24,8 @@ description: Here you can find meta information about this website.
</li>
<li><span class="font-weight-bold">(Almost) no javascript</span>:
This site uses almost no javascript. Javascript is only used to make the menus responsive, to replace the
Font Awesome span elements with svg elements and to load images on demand to make site loading faster.
Font Awesome span elements with svg elements, to offer a "back-to-top" button and to load images on demand to
make site loading faster.
</li>
<li><span class="font-weight-bold">(Almost) no external requests</span>:
To protect your privacy as good as possible, the amount of external requests is as low as possible. External