Skip to content

Commit

Permalink
Merge pull request #201 from Zavy86/fix-200
Browse files Browse the repository at this point in the history
fix back to top
  • Loading branch information
Zavy86 authored Oct 16, 2024
2 parents 27d60be + 8e50f9e commit 2c167e8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.60
1.0.61
4 changes: 4 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,7 @@ pre.debug{margin:9px;font-size:12px;}

.table-picker { position: absolute; padding: 3px; z-index: 1000;}
.table-picker .cell { width: 20px; height: 20px; display: inline-block; margin: 3px; cursor: pointer;}

/* back to top button */
.top{display:none;position:fixed;bottom:15px;left:240px;z-index:99;font-size:12px;border:none;outline:none;background-color:#4caf50;color:white;cursor:pointer;padding:15px;border-radius:4px;}
@media only screen and (max-width:992px){.top{left:30px;}}
26 changes: 7 additions & 19 deletions template.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function gtag(){dataLayer.push(arguments);}
</div>
</header>
<main>
<button class="top" id="backToTop">&#8679;</button>
<div class="container">
<div class="row breadcrumbs" style="padding-top:18px">
<div class="col s2 m1 offset-m1 hide-on-large-only">
Expand Down Expand Up @@ -338,7 +339,6 @@ function gtag(){dataLayer.push(arguments);}
</main>
<script>var APP=<?= json_encode($APP->export()) ?>;</script>
<script>var DOC=<?= json_encode($DOC->export()) ?>;</script>
<button onclick="topFunction()" id="myBtn" title="Go to top" style="display: none; position: fixed;bottom: 15px;right: 30px;z-index: 99;font-size: 12px;border: none;outline: none;background-color: #4caf50;color: white;cursor: pointer;padding: 15px;border-radius: 4px;">Top</button>
<script src="<?= $APP->PATH ?>helpers/jquery-3.7.0/js/jquery.min.js"></script>
<script src="<?= $APP->PATH ?>helpers/materialize-1.0.0/js/materialize.min.js"></script>
<script src="<?= $APP->PATH ?>helpers/highlightjs-11.9.0/js/highlight.min.js"></script>
Expand Down Expand Up @@ -377,24 +377,12 @@ function gtag(){dataLayer.push(arguments);}
</script>
<?php endif; ?>
<script>
// Get the button Top
let mybutton = document.getElementById("myBtn");

// When the user scrolls down 30px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};

function scrollFunction() {
if (document.body.scrollTop > 40 || document.documentElement.scrollTop > 40) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}
document.getElementById("backToTop").addEventListener("click",function(){
window.scrollTo({top:0,behavior:'smooth'});
});
window.addEventListener("scroll",function(){
document.getElementById("backToTop").style.display=(window.scrollY>40?"block":"none");
});
</script>
<script>
function new_document(){
Expand Down

0 comments on commit 2c167e8

Please sign in to comment.