open/close sidenav bar same button
<p>I have a button that I'm hoping will open and close a side nav.  My button code is:</p>

<pre><code>&lt;button class="myBtn" id="myBtn"&gt;&lt;i class="glyphicon glyphicon-info-sign"&gt;&lt;/i&gt;&lt;/button&gt; 
</code></pre>

<p>I'm trying to use addEventListener and think i may be missing an if statement in this, but can't be sure:</p>

<pre><code>document.getElementById("myBtn").addEventListener("click", open);
    function open() {
        document.getElementById("mySidenav").style.width = "250px";
        document.getElementById("main").style.marginLeft = "250px";
        document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
document.getElementById("myBtn").addEventListener("click", close);
    function close() {
         document.getElementById("mySidenav").style.width = "0";
        document.getElementById("main").style.marginLeft = "0";
        document.body.style.backgroundColor = "white";
} 
</code></pre>

<p>any suggestions?  thanks!</p>