Preparing to add AJAX

This commit is contained in:
Michał Gdula 2022-08-02 14:13:35 +01:00
parent 4c064eeaed
commit a52f2c3da7
13 changed files with 77 additions and 55 deletions

View file

@ -1,11 +1,13 @@
button = document.getElementById("back-to-top");
$(document).ready(function() {
button = document.getElementById("back-to-top");
window.onscroll = function() {scrollFunction()};
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
button.style.right = "1rem";
} else {
button.style.right = "-2.5rem";
function scrollFunction() {
if (document.body.scrollTop > 300 || document.documentElement.scrollTop > 20) {
button.style.right = "1rem";
} else {
button.style.right = "-2.5rem";
}
}
}
});