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.
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!
URL: https://tnucii.weebly.com/new-page.html
Code:
<html>
<head>
<meta charset="UTF-8">
<title>Blackboard Communication Tools for Students</title>
</head>
<style>
body {
font-family: "Raleyway", sans-serif;
transition: background-color .5s;
}
.sidenav {
height: 100%;
width: 0;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
}
.sidenav a {
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 25px;
color: #818181;
display: block;
transition: 0.3s;
}
.sidenav a:hover {
color: #f1f1f1;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 25px;
font-size: 36px;
margin-left: 50px;
}
#main {
transition: margin-left .5s;
padding: 16px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
.sidenavmenu { color: #252525;
}
.sidenavmenu:hover {
opacity: .5;
}
</style>
<body>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a></a>
<a href="#">Our Team</a>
<a href="#">Blackboard Learn Resources</a>
<ul>
<li> <a href="#">Faculty Resources</a></li>
<ul>
<li> <a href="#">Getting Started</a></li>
<li> <a href="#">Coruse Content Management</a></li>
<li> <a href="#">Grades and Feedback</a></li>
<li> <a href="#">Communicaiton</a></li>
</ul>
<li> <a href="#">Student Resources</a></li>
<ul>
<li> <a href="#">Getting Started</a></li>
<li> <a href="#">Communicaiton</a></li>
<li> <a href="#">Coruse Content</a></li>
<li> <a href="#">Grades and Feedback</a></li>
</ul>
</ul>
<a href="#">Accessibility Resources</a>
<ul>
<li> <a href="#">Faculty Resources</a></li>
<ul>
<li> <a href="#">Blacbkoard Ally</a></li>
<li> <a href="#">Accessible Design</a></li>
<li> <a href="#">Captioning</a></li>
<li> <a href="#">Accessbile Live Sessions</a></li>
</ul>
<li> <a href="#">Student Resources</a></li>
<ul>
<li><a href="#">Blacbkoard Ally</a></li>
<li><a href="#">Captioning</a></li>
</ul>
</ul>
<a href="#">Clients</a>
<a href="#">Contact</a>
</div>
<span class="sidenavmenu" style="font-size:13px;cursor:pointer" onclick="openNav()">☰ Knowledge Base Navigation </span>
<p></p>
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "350px";
document.getElementById("main").style.marginLeft = "350px";
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>
</body>
</html>
Change it to 1 ;-)
Your navigation is above your sidebar.