Testing hugo
This commit is contained in:
commit
e3975962fa
327 changed files with 17224 additions and 0 deletions
42
public/themes/novela/assets/js/progressBar.js
Normal file
42
public/themes/novela/assets/js/progressBar.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
window.addEventListener("scroll", updateProgress);
|
||||
|
||||
progressBar = document.getElementById("progressBar");
|
||||
scrollProgress = document.getElementById("progressIndicator");
|
||||
|
||||
if (document.getElementById("subscriptionSection")){
|
||||
articleSubscription = document.getElementById("subscriptionSection").offsetHeight;
|
||||
}
|
||||
else{
|
||||
articleSubscription = 0;
|
||||
}
|
||||
|
||||
if(document.getElementById("articleNext")){
|
||||
articleNext = document.getElementById("articleNext").offsetHeight;
|
||||
}
|
||||
else{
|
||||
articleNext = 0;
|
||||
}
|
||||
|
||||
footerSection = 150;
|
||||
|
||||
bottomOffset = ((articleSubscription + articleNext + footerSection + 250) / document.body.scrollHeight) * 100 ;
|
||||
bottomOffset += bottomOffset * 1.1;
|
||||
|
||||
|
||||
function updateProgress(){
|
||||
let percentScrolled = (window.pageYOffset / document.body.scrollHeight) * (100 + bottomOffset);
|
||||
scrollProgress.style.transform = "translateY(" + percentScrolled + "%)";
|
||||
|
||||
if (percentScrolled > 100){
|
||||
progressBar.style.animationName = "progress-fade-out";
|
||||
setTimeout(function(){
|
||||
progressBar.style.opacity = "0";
|
||||
}, 500);
|
||||
}
|
||||
else{
|
||||
progressBar.style.animationName = "progress-fade-in";
|
||||
setTimeout(function(){
|
||||
progressBar.style.opacity = "1";
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue