Difference between revisions of "Template:Valencia UPV/navBar"

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

Revision as of 17:02, 13 September 2018