Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div id="show" class="show">
  <nav>
    <a id="nav-toggle" href="#"><span></span></a>
  </nav>
</div>
<div id="overlay" name="Overlay" class="overlay">
  <ul class="hamburger_menu">
    <li><a href="#top">TOP</a></li>
    <li><a href="#newsletter">NEWSLETTER</a></li>
    <li><a href="#videos">VIDEOS</a></li>
    <li><a href="#contact">CONTACT</a></li>
  </ul>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
</div>
</body>
</html>
 
#nav-toggle span {
  position: absolute;
  margin-top: 10px;
}
#nav-toggle span,
#nav-toggle span:before,
#nav-toggle span:after {
  cursor: pointer;
  border-radius: 4px;
  height: 3px;
  width: 18px;
  background: #1098fe;
  position: absolute;
  display: block;
  content: '';
}
#nav-toggle span:before {
  top: -5px;
}
#nav-toggle span:after {
  bottom: -5px;
}
#nav-toggle span,
#nav-toggle span:before,
#nav-toggle span:after {
  transition: all 500ms ease-in-out;
}
#nav-toggle.active span {
  background-color: transparent;
}
#nav-toggle.active span:before,
#nav-toggle.active span:after {
  top: 0;
}
#nav-toggle.active span:before {
  transform: rotate(45deg);
  background: #fe0000;
}
#nav-toggle.active span:after {
  transform: rotate(-45deg);
  background: #fe0000;
}
#overlay {
  display: none;
}
 
// cache DOM elements as jquery objects
// adding $ to jquery objects is a good practice
var $overlay = $('#overlay'),
    $nav = $('#nav-toggle'),
    $links = $('#overlay a');
// descriptive names
function funcToggleNav() {
  $overlay.toggle("slow");
}
function funcToggleBurger () {
  $nav.toggleClass("active");
}
$nav.on("click", function () {
  funcToggleBurger();
  funcToggleNav();
});
$links.on("click", function () {
  funcToggleBurger();
  funcToggleNav();
})
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers