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() {
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>
</head>
@ -823,7 +832,7 @@
</ul>
</nav>
</div>
<div>
<div id="fixedbuttondiv">
<a href="#head" onclick="openNav()">
<img id="fixedbutton" src="files/menu.png" >
</a>