Fixed scrolling to top for beginner page

This commit is contained in:
Angelos Chalaris
2018-04-07 16:30:56 +03:00
parent 5a4f19345c
commit 2dd7d38e49
2 changed files with 4 additions and 4 deletions

View File

@ -14,10 +14,10 @@
<link rel="icon" type="image/png" href="favicon.png">
<script>
function scrollToTop(){
const c = document.querySelector('body').scrollTop;
const c = document.querySelector('html').scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
document.querySelector('body').scrollTo(0, c - c / 4);
document.querySelector('html').scrollTo(0, c - c / 4);
}
};
function scrollTo(element, to, id, duration) {

View File

@ -14,10 +14,10 @@
<link rel="icon" type="image/png" href="favicon.png">
<script>
function scrollToTop(){
const c = document.querySelector('body').scrollTop;
const c = document.querySelector('html').scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
document.querySelector('body').scrollTo(0, c - c / 4);
document.querySelector('html').scrollTo(0, c - c / 4);
}
};
function scrollTo(element, to, id, duration) {