menu open onload problem

Solutions on MaxInterview for menu open onload problem by the best coders in the world

showing results for - "menu open onload problem"
Laura
15 Aug 2020
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}
Jérémie
09 Jun 2018
1#nav{
2  display:none;
3}
Bret
28 Jan 2019
1// self executing function
2(function() {
3      var x = document.getElementById("nav");
4      x.style.display = "none";
5})();