Trying to have my menu push the content to the left and make it opaque until the user closes the menu. With Weebly, the page HTML main content is shown as:
The menu is a custom HTML embed item on the page. Below is the code I have for the menu element. As I said before it is working fine but if I can get it to push the content to the left with opacity, that would be awesome.
function openNav() {
document.getElementById("mySidenav").style.width = "350px";
document.getElementsByClassName("main-wrap").style.marginLeft = "350px";
document.body.style.backgroundColor = "rgba(0,0,0,0.4)";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementsByClassName("main-wrap").style.marginLeft = "0";
document.body.style.backgroundColor = "white";
}
<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><style>.sidebar-content {
position: static;
background-color: #F9F9F9;
padding: 15px;
text-decoration: none;
font-weight: 300;
font-size: 20px;
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, "sans-serif";
}
h2 {
font-weight: 400px;
color: #460E72;
font-size: x-large;
font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
}
a:link {
text-decoration: none;
color: #B6B6BA;
}
a:visited {
text-decoration: none;
color: #404041;
}
a:hover {
color: #404041;
background-color: #eeeeee;
cursor: pointer;
}
a:active {
text-decoration: none;
color: #FF6712;
}
<style>.sidebar-content {
top: 0;
position: static;
width: 256px;
max-widtH: 296px;
left: - 275px;
transition: top 0.3s;
}
</style>
<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>