NEW: add back-to-top button
This commit is contained in:
parent
d47d80db28
commit
166204db8c
2 changed files with 47 additions and 2 deletions
|
@ -26,4 +26,24 @@
|
|||
pangu.autoSpacingPage();
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{/* back-top- button */}}
|
||||
<button id="back-top-button"><i class="fas fa-chevron-up"></i></button>
|
||||
<script>
|
||||
window.onscroll = function() {scrollFunction()};
|
||||
function scrollFunction() {
|
||||
if (document.body.scrollTop > 30 || document.documentElement.scrollTop > 30) {
|
||||
$("#back-top-button").fadeIn();
|
||||
} else {
|
||||
$("#back-top-button").fadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$( "#back-top-button" ).click(function() {
|
||||
$("html, body").animate({scrollTop: 0}, 500);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue