Press "Enter" to skip to content

Slide and Push Menu Transitions With Vanilla Javascript | slidemenu

Slidemenu is the minimalist off-canvas push navigation, which reveals the list of the sidebar while pushing the main content to the right. Built with CSS and a little JavaScript.

multi level push menu, push menu css, react multi level push menu, push menu plugin, slide and push menus with css3 transitions, multi level menu examples

How to make use of it:

1. Create a hamburger list button with the side menu on the web page.

<span class="open-side">
  <a href="#" onclick="openSideMenu()">
    <svg width="30" height="30">
      <path d="M0,5 30,5" stroke="#fff" stroke-width="5"/>
      <path d="M0,14 30,14" stroke="#fff" stroke-width="5"/>
      <path d="M0,23 30,23" stroke="#fff" stroke-width="5"/>
    </svg>
  </a>
</span>
<div id="side-menu" class="side-nav">
  <a href="#" class="btn-close" onclick="closeSideMenu()">&times;</a>
  <a href="#">Home</a>
  <a href="#">About</a>
  <a href="#">Services</a>
  <a href="#">Contact</a>
</div>

2. Enter your main content in the document.

<div id="main">
  <h1>Side Menu</h1>
</div>

3. Basic CSS patterns.

.side-nav {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: #111;
  opacity: 0.9;
  overflow-x: hidden;
  padding-top: 60px;
  transition: 0.5s;
}
.side-nav a {
  padding: 10px 10px 10px 30px;
  text-decoration: none;
  font-size: 22px;
  color: #ccc;
  display: block;
  transition: 0.3s;
}
.side-nav a:hover { color: #008080; }
.side-nav .btn-close {
  position: absolute;
  top: 0;
  right: 22px;
  font-size: 36px;
  margin-left: 50px;
}
#main {
  transition: margin-left 0.5s;
  padding: 20px;
  overflow: hidden;
  width: 100%;
}

4. The main javascript to switch CSS chapters while opening/closing the side menu.

function openSideMenu(){
  document.getElementById('side-menu').style.width ='250px';
  document.getElementById('main').style.marginLeft ='250px';
}
function closeSideMenu(){
  document.getElementById('side-menu').style.width ='0';
  document.getElementById('main').style.marginLeft ='0';
}

minimalist side push menu, slidemenu Plugin/Github


See Demo And Download

Official Website(nigeljaure): Click Here

This superior jQuery/javascript plugin is developed by nigeljaure. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.