Difference between revisions of "Template:UESTC-China/nav"

Line 175: Line 175:
 
</div>
 
</div>
 
<script>
 
<script>
// When the user scrolls the page, execute myFunction
+
window.onload=function()
window.onscroll = function() {myFunction()};
+
{
 
+
    window.onscroll = function() {myFunction()};
function myFunction() {
+
  function myFunction() {
 
   var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
 
   var winScroll = document.body.scrollTop || document.documentElement.scrollTop;
 
   var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
 
   var height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
 
   var scrolled = (winScroll / height) * 100;
 
   var scrolled = (winScroll / height) * 100;
 
   document.getElementById("myBar").style.width = scrolled + "%";
 
   document.getElementById("myBar").style.width = scrolled + "%";
 +
  }
 
}
 
}
 
</script>
 
</script>

Revision as of 03:24, 31 August 2019

description