Is there a way to adjust this code so that the side nav bar remains open when the page loads for the first time? I would like the side nav to be open by default.
function openNav() {
document.getElementById("mySidenav").style.width = "250px";
document.getElementById("main").style.marginLeft = "250px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft = "0";
document.body.style.backgroundColor = "white";
}
<div id="wrapper">
<header>
<div></div>
</header>
<nav>
<span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ Learn Here</span>
<div id="mySidenav" class="sidenav">
<img src="https://cloud.netlifyusercontent.com/assets/344dbf88-fdf9-42bb-adb4-46f01eedd629/68dd54ca-60cf-4ef7-898b-26d7cbe48ec7/10-dithering-opt.jpg" height="20%" width="70%" style="padding-left: 36px; padding-right: 36px">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a class="nav_padding" href="#">About me</a>
<a class="nav_padding" href="#">Resume</a>
<a class="nav_padding" href="#">Projects</a>
<a class="nav_padding" href="#">Contact Me</a>
<script>
</script>
</div>
</nav>
</div>