main
diff --git a/scripts/example.js b/scripts/example.js index ca41a87..d539db9 100644 --- a/scripts/example.js +++ b/scripts/example.js @@ -1,11 +1,23 @@ +let sidebarEl = document.getElementById("mySidebar") +let mainEl = document.getElementById("main") + /* Set the width of the sidebar to 250px and the left margin of the page content to 250px */ function openNav() { - document.getElementById("mySidebar").style.width = "250px"; - document.getElementById("main").style.marginLeft = "250px"; + sidebarEl.style.width = "250px"; + mainEl.style.marginLeft = "250px"; } /* Set the width of the sidebar to 0 and the left margin of the page content to 0 */ function closeNav() { - document.getElementById("mySidebar").style.width = "0"; - document.getElementById("main").style.marginLeft = "0"; + sidebarEl.style.width = "0"; + mainEl.style.marginLeft = "0"; +} + +/* Toggle the sidebar */ +function toggleNav() { + if (sidebarEl.offsetWidth > 0) { + closeNav() + } else { + openNav() + } } \ No newline at end of file diff --git a/static/Styles/example.css b/static/Styles/example.css index 1b5e40d..024d1c7 100644 --- a/static/Styles/example.css +++ b/static/Styles/example.css @@ -10,6 +10,7 @@ overflow-x: hidden; /* Disable horizontal scroll */ padding-top: 60px; /* Place content 60px from the top */ transition: 0.5s; /* 0.5 second transition effect to slide in the sidebar */ + font-family: "Agency FB"; } /* The sidebar links */