Expand Collapse menu on click

I am trying to replicate this menu found here: http://www.google.com/makani/ (which is only viewable on mobile or tablet devices).

I have managed to replicate the static menu button, but i am struggling to get the contents to exapnd on click.

HTML:

<body>


<div class="header compact" role="banner">
    <div class="menu ">
      <h2> Menu </h2>
      <div class="nav" style="width: 536px; height: 615px;">
        <ul role="navigation" class="nav-main">
          <li class="active">
            <a href="../makani/" data-ga-event="Header,Navigate,Home">Home</a>
          </li>
          <li>
            <a href="../makani/challenge/" data-ga-event="Header,Navigate,The Challenge">The
              Challenge</a>
          </li>
        </ul>
        <ul role="contentinfo" class="nav-aux">
          <li>
            <a href="../makani/faq/" data-ga-event="Footer,Navigate,FAQ">FAQ</a>
          </li>
          <li>
            <a href="../makani/about/" data-ga-event="Footer,Navigate,About Us">About Us</a>
          </li>
        </ul>
      </div>
      <button type="button">Close</button>
    </div>
  </div>
</body>

CSS:

.menu {
    height: 100%;
    overflow: hidden;
    position: fixed;
    right: 0;
    top: 0;
    transform: skew(45deg);
    transform-origin: right top 0;
    transition: all 0.3s ease-in-out 0s;
    width: 90px;
    z-index: 20;
}

.menu h2 {
    opacity: 1;
    padding: 20px 10px 60px 50px;
    right: 0;
    z-index: 30;
}
.menu h2, .menu button {
    color: #fff;
    cursor: pointer;
    font-size: 8px;
    font-weight: bold;
    letter-spacing: 1px;
    margin: 0;
    text-transform: uppercase;
    transition: all 0.3s ease-in-out 0s;
}
.menu h2, .menu button, .nav {
    position: absolute;
    top: 0;
    transform: skew(-45deg);
    transform-origin: right top 0;
}

.nav {
    background: none repeat scroll 0 0 #0bb5fd;
    box-sizing: border-box;
    padding: 100px 20px 20px;
    right: 0;
    z-index: 20;
}

.menu h2, .menu button, .nav {
    position: absolute;
    top: 0;
    transform: skew(-45deg);
    transform-origin: right top 0;
}
.header, .nav, .hero, .section {
    transition: all 0.2s ease 0s;
}

.header {
    background-image: linear-gradient(to bottom, rgba(44, 44, 44, 0.2), rgba(39, 39, 39, 0));
    box-sizing: border-box;
    left: 0;
    padding: 20px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 10;
}
.header, .nav, .hero, .section {
    transition: all 0.2s ease 0s;
}

JS:

$(function() { 
  $( ".menu" ).click(function() {
    $(this).addClass("active");
  });
});

Plunker: http://plnkr.co/edit/2NrZtw5n5gvvMGf4Wi3m?p=preview


UPDATE:

New plunker: http://plnkr.co/edit/2NrZtw5n5gvvMGf4Wi3m?p=preview

New plunker: http://plnkr.co/edit/2NrZtw5n5gvvMGf4Wi3m?p=preview

Alot of the functionlity is there, just struggling to align the menu items.


Source: css3

Leave a Reply