Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Elb authored Jun 25, 2023
1 parent ef2f477 commit a4b1b60
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions js/script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
// When the user scrolls the page, execute pageScroll function
window.onscroll = function() {
pageScroll();
};

function pageScroll() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("proBar").style.width = scrolled + "%";
}

// Fancy word effect

Expand Down Expand Up @@ -80,34 +70,43 @@ enhance("channel-link");
// }, 30);
// }

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

let mybutton = document.getElementById("btn-back-to-top");
let navbar = document.getElementById("navScroll");
function pageScroll() {
var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
var scrolled = (winScroll / height) * 100;
document.getElementById("proBar").style.width = scrolled + "%";
}

//Get to the top button

// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function () {
scrollFunction();
};
let mybutton = document.getElementById("btn-back-to-top");
// let navbar = document.getElementById("navScroll");

function scrollFunction() {
if (
document.body.scrollTop > 1000 ||
document.documentElement.scrollTop > 1000
) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}
}
// When the user clicks on the button, scroll to the top of the document
mybutton.addEventListener("click", backToTop);

function backToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
) {
mybutton.style.display = "block";
} else {
mybutton.style.display = "none";
}

}

// When the user clicks on the button, scroll to the top of the document
mybutton.addEventListener("click", backToTop);

function backToTop() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
}



0 comments on commit a4b1b60

Please sign in to comment.