Manage nav button visibility

This commit is contained in:
Matthieu Dubuget 2018-09-30 17:22:07 +02:00
parent f9f3045fc4
commit e228d09008

View File

@ -44,6 +44,15 @@
function closeNav() { function closeNav() {
document.getElementById("mySidenav").style.width = "0"; document.getElementById("mySidenav").style.width = "0";
} }
/* Manage navigation visibility */
var prevScrollpos = window.pageYOffset;
window.onscroll = function() {
var currentScrollpos = window.pageYOffset;
var visibility = (prevScrollpos > currentScrollpos) ? "visible" : "hidden";
document.getElementById("fixedbuttondiv").style.visibility = visibility;
prevScrollpos = currentScrollpos;
}
</script> </script>
</head> </head>
@ -823,7 +832,7 @@
</ul> </ul>
</nav> </nav>
</div> </div>
<div> <div id="fixedbuttondiv">
<a href="#head" onclick="openNav()"> <a href="#head" onclick="openNav()">
<img id="fixedbutton" src="files/menu.png" > <img id="fixedbutton" src="files/menu.png" >
</a> </a>