File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 2020 < script src ="https://unpkg.com/scrollreveal "> </ script >
2121 </ head >
2222 < body >
23+ < div id ="progressBarContainer ">
24+ < div id ="progressBar "> </ div >
25+ </ div >
2326 < nav class ="navbar ">
2427 < div class ="navbar-left " onclick ="window.location.href=`index.html` ">
2528 < img src ="assets/recode-hive.png " alt ="Recode Hive Icon " class ="navbar-icon ">
Original file line number Diff line number Diff line change @@ -39,3 +39,16 @@ function scrollToTop() {
3939
4040 requestAnimationFrame ( animation ) ; // Start the animation
4141}
42+
43+ window . onscroll = function ( ) {
44+ updateProgressBar ( ) ;
45+ } ;
46+
47+
48+ function updateProgressBar ( ) {
49+ var scrollTop = document . documentElement . scrollTop || document . body . scrollTop ;
50+ var scrollHeight = document . documentElement . scrollHeight - document . documentElement . clientHeight ;
51+ var scrollPercent = ( scrollTop / scrollHeight ) * 100 ;
52+
53+ document . getElementById ( "progressBar" ) . style . width = scrollPercent + "%" ;
54+ }
Original file line number Diff line number Diff line change @@ -1391,3 +1391,20 @@ a {
13911391 right : 10px ;
13921392 cursor : pointer;
13931393}
1394+
1395+ # progressBarContainer {
1396+ position : fixed;
1397+ top : 0 ;
1398+ left : 0 ;
1399+ width : 100% ;
1400+ height : 7px ;
1401+ background-color : # 333 ;
1402+ z-index : 9999 ;
1403+ }
1404+
1405+ # progressBar {
1406+ height : 100% ;
1407+ width : 0% ;
1408+ background : white;
1409+ transition : width 0.2s ease;
1410+ }
You can’t perform that action at this time.
0 commit comments