44 lines
2.3 KiB
HTML
44 lines
2.3 KiB
HTML
<!-- Optional JavaScript -->
|
|
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
|
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
|
|
<script src="https://unpkg.com/bootstrap-table@1.16.0/dist/bootstrap-table.min.js"></script>
|
|
<!-- For Scroll to Top text; from https://getflywheel.com/layout/sticky-back-to-top-button-tutorial/ -->
|
|
<script>
|
|
// Set a variable for our button element.
|
|
const scrollToTopButton = document.getElementById('js-top');
|
|
|
|
const scrollFunc = () => {
|
|
// Get the current scroll value
|
|
let y = window.scrollY;
|
|
|
|
// If the scroll value is greater than the window height, let's add a class to the scroll-to-top button to show it!
|
|
if (y > 0) {
|
|
scrollToTopButton.className = "top-link show";
|
|
} else {
|
|
scrollToTopButton.className = "top-link hide";
|
|
}
|
|
};
|
|
window.addEventListener("scroll", scrollFunc);
|
|
const scrollToTop = () => {
|
|
// Let's set a variable for the number of pixels we are from the top of the document.
|
|
const c = document.documentElement.scrollTop || document.body.scrollTop;
|
|
|
|
// If that number is greater than 0, we'll scroll back to 0, or the top of the document.
|
|
// We'll also animate that scroll with requestAnimationFrame:
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
|
|
if (c > 0) {
|
|
window.requestAnimationFrame(scrollToTop);
|
|
// ScrollTo takes an x and a y coordinate.
|
|
// Increase the '10' value to get a smoother/slower scroll!
|
|
window.scrollTo(0, c - c / 10);
|
|
}
|
|
};
|
|
// When the button is clicked, run our ScrolltoTop function above!
|
|
scrollToTopButton.onclick = function(e) {
|
|
e.preventDefault();
|
|
scrollToTop();
|
|
}
|
|
</script>
|