1// self executing function
2(function() {
3 if(window.localStorage.getItem('nav') === null){
4 window.localStorage.setItem('nav', 'none');
5 }
6 var x = document.getElementById("nav");
7 x.style.display = window.localStorage.getItem('nav');
8})();
9
10function myFunction() {
11 var x = document.getElementById("nav");
12 if (x.style.display === "block") {
13 x.style.display = "none";
14 } else {
15 x.style.display = "block";
16 }
17 window.localStorage.setItem('nav', x.style.display);
18}
1// self executing function
2(function() {
3 var x = document.getElementById("nav");
4 x.style.display = "none";
5})();