x

Set Up Side Navigation Menu HTML Elemnt

Hey all, 

 I am having trouble getting my HTML custom embed sidebar navigation menu to close on my Weebly page. I built it in Dreamweaver and it is working perfectly fine when viewing on their or view the HTML element itself. Even on the Weebly standard page, I can click on the icon to open the menu and it fleshes out perfectly. However, I can't close the menu (unless I refresh the page). 

Any help or advice on how to make this possible would be great! I want to be able to add this element smoothly to each of my standard pages. 

URL: https://tnucii.weebly.com/new-page.html

The script code I have for the actions are below:

<script>
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";
}
</script>

I am very new to code and understand that this probably should have been built before adding content to the pages but it would be awesome if I could just get the last function "closeNav" to work! 

437 Views
Message 1 of 1
Report
0 REPLIES 0