NEW: add back-to-top button
This commit is contained in:
parent
d47d80db28
commit
166204db8c
2 changed files with 47 additions and 2 deletions
|
@ -312,3 +312,28 @@ hr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* END - footer*/
|
/* END - footer*/
|
||||||
|
|
||||||
|
|
||||||
|
/* back-to-top button */
|
||||||
|
#back-top-button {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 20px;
|
||||||
|
right: 30px;
|
||||||
|
z-index: 99;
|
||||||
|
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
|
background-color: #d1d1d1; /* Set a background color */
|
||||||
|
color: #2157ad; /* Text color */
|
||||||
|
|
||||||
|
opacity: 0.85;
|
||||||
|
|
||||||
|
cursor: pointer; /* Add a mouse pointer on hover */
|
||||||
|
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,3 +27,23 @@
|
||||||
});
|
});
|
||||||
</script>
|
</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
Reference in a new issue