title: Off-canvas menu and a fixed positioned header
body: <p>I am creating a very basic off canvas menu, everything is working brilliantly BUT this one small thing that I can't fix! </p>
  
  <ol>
  <li>Visit <a href="http://www.loaistudio.com" rel="nofollow">www.loaistudio.com</a> and re-size the window to under 1000px.</li>
  <li>Scroll down a bit and then click on the Menu button from the top left on the header. </li>
  </ol>
  
  <p>Why does it despair? it actually does not despair but it just move to the very top of the page! Why is that? How can I fix it and just keep it to the top of the view area... </p>
  
  <p>Here is the <strong>HTML</strong></p>
  
  <pre><code>&lt;div id="page"&gt;&lt;!--Main Container--&gt;
      &lt;!--Header (small screens only)--&gt;
      &lt;div id="secondHeader"&gt;
          &lt;a class="secondHeader-menuButton" href="#"&gt;Menu&lt;/a&gt;
          &lt;p id="logo-smallScreen"&gt;Website Name&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;!--/////////////////////////////////////////////////--&gt;
  
      &lt;div class="wrapper"&gt;
          &lt;div id="homeSectionA" class="content"&gt;
  
              &lt;h1&gt;Header One&lt;/h1&gt;
  
              &lt;h2&gt;Header Two&lt;/h2&gt;
  
              &lt;h3&gt;Header Three&lt;/h3&gt;
  
              &lt;h4&gt;Header Four&lt;/h4&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;&lt;strong&gt;Paragraph Strong&lt;/strong&gt;&lt;/p&gt;
  
              &lt;p&gt;&lt;em&gt;Paragraph Empaissaied&lt;/em&gt;&lt;/p&gt;
  
              &lt;p&gt;&lt;small&gt;Paragraph Small&lt;/small&gt;&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;a&gt;I am a Button&lt;/a&gt;
  
              &lt;br&gt;&lt;br&gt;
  
              &lt;p&gt;&lt;strong&gt;List&lt;/strong&gt;&lt;/p&gt;
  
              &lt;ul&gt;
                  &lt;li&gt;List Item&lt;/li&gt;
                  &lt;li&gt;List Item
                      &lt;ul&gt;
                          &lt;li&gt;Sub List Item&lt;/li&gt;
                          &lt;li&gt;Sub List Item&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;&lt;strong&gt;List&lt;/strong&gt;&lt;/p&gt;
  
              &lt;ol&gt;
                  &lt;li&gt;List Item&lt;/li&gt;
                  &lt;li&gt;List Item
                      &lt;ol&gt;
                          &lt;li&gt;Sub List Item&lt;/li&gt;
                          &lt;li&gt;Sub List Item&lt;/li&gt;
                      &lt;/ol&gt;
                  &lt;/li&gt;
              &lt;/ol&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;Abber (&lt;abbr title="Oh, you found me :)"&gt;Hover over me&lt;/abbr&gt;).&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;Paragraph&lt;sub&gt;subscript.&lt;/sub&gt;&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;Paragraph&lt;sup&gt;subscript.&lt;/sup&gt;&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;p&gt;Paragraph&lt;mark&gt;Marked Line&lt;/mark&gt;&lt;/p&gt;
  
              &lt;br&gt;
  
              &lt;img alt="" src="http://placehold.it/600x400/cdcdcd"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;!--Footer--&gt;
      &lt;footer id="footer"&gt;
          &lt;?php include ("assets/templates/footer.inc"); ?&gt;
      &lt;/footer&gt;
  &lt;/div&gt;&lt;!--The End Of The Page--&gt;
  </code></pre>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>/* Landscape Tablets //////////////////////////////////////////////////////////////////////////////////*/
  @media screen and (max-width: 1024px) {
  
      body, #headerContent {
          min-width: 100%;
      }
  
      /*PAGE LAYOUT ==================================================================*/
      /*Main Page Container*/#page {
          padding-top: 50px;
          z-index: 1;
          -webkit-box-shadow: -3px 0px 20px rgba(0, 0, 0, 0.8);
          -moz-box-shadow: -3px 0px 20px rgba(0, 0, 0, 0.8);
          box-shadow: -3px 0px 20px rgba(0, 0, 0, 0.8);
  
          -webkit-transition: all 0.2s ease-out;
          -moz-transition: all 0.2s ease-out;
          -ms-transition: all 0.2s ease-out;
          -o-transition: all 0.2s ease-out;
          transition: all 0.2s ease-out;
      }
  
      /*Content Container*/
      .content {
          padding: 30px;
      }
  
  
      /*HEADER ======================================================================*/
      /*Header Wrapper*/
      #headerWrapper {
          background-color: #191E25;
  
          width: 200px; height: 100%;
          z-index: 0;
  
          -webkit-box-shadow: none;
          -moz-box-shadow: none;
          box-shadow: none;
  
          -webkit-transition: all 0.2s ease-out;
          -moz-transition: all 0.2s ease-out;
          -ms-transition: all 0.2s ease-out;
          -o-transition: all 0.2s ease-out;
          transition: all 0.2s ease-out;
  
          -webkit-transform: translate(-200px, 0px);
          -moz-transform: translate(-200px, 0px);
          -o-transform: translate(-200px, 0px);
          -ms-transform: translate(-200px, 0px);
          transform: translate(-200px, 0px);      
      }
  
          #headerWrapper.headerOpen {
              -webkit-transform: translate(0px, 0px);
              -moz-transform: translate(0px, 0px);
              -o-transform: translate(0px, 0px);
              -ms-transform: translate(0px, 0px);
              transform: translate(0px, 0px);    
          }
  
          #page.pageOpen {
              -webkit-transform: translate(200px, 0px);
              -moz-transform: translate(200px, 0px);
              -o-transform: translate(200px, 0px);
              -ms-transform: translate(200px, 0px);
              transform: translate(200px, 0px);  
          }
  
  
      /*Header Content Container*/
      #headerContent {
          width: 210px; height: 100%;
          padding: 0;
          margin: 0;
          overflow-y: auto;
          overflow-x: hidden;
      }
  
          /*Header Logo*/
          #headerLogo {
              display: none;
          }
  
          /*Main Menu*/
          #mainMenu, #mainMenu li {
              text-align: left;
              margin-top: 0;
              float: none;
          }
  
          #mainMenu a {
              color: #A0A8B1;
              border-bottom: 1px solid #13171C;
  
              width: 100%;  
              padding: 20px 0px 20px 20px;
              margin: 0;
  
              border-radius: 0;
              -moz-border-radius: 0;
              -webkit-border-radius: 0;
          }
  
              #mainMenu a:hover {
                  color: #CACFD3;
                  background-color: #232A34;
              }
  
              #mainMenu a.active {
                  color: #6E737A;
                  background-color: #13171C;
              }
  
  
      /*Second Header Container &amp; Elements (Hidden From Widescreen)*/
      #secondHeader {
          color: #FFFFFF;
          background-color: #49AB8E;
          border-bottom: 1px solid #398770;
  
          width: 100%;
          display: block;
          position: fixed; top: 0;
          padding: 0 20px 0 0;
          z-index: 1000;
          line-height: 50px;
      }
  
          .secondHeader-menuButton {
              background: #41997F url('../../assets/elements/nav-icon.png') no-repeat 20px;
              background-size: 25px 24px;
              width: 120px;
              display: inline-block;
              font-weight: bold;
              text-indent: 55px;
          }
  
              .secondHeader-menuButton-active {
                  background: #41997F url('../../assets/elements/nav-icon-close.png') no-repeat 20px;
                  background-size: 25px 24px;
              }
  
          #logo-smallScreen {
              display: inline-block;
              float: right;
          }
  
  
  
      /*PAGES ======================================================================*/ 
      /*Contact Page*/
      #contactDetails {
          width: 50%;
          padding-left: 50px;
          margin-left: -6px;
          text-align: center;
      }
  
      #contactForm {
          width: 50%;
      }
  
  }
  
  
  
  
  
  /*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
  /* Portrait Tablets ///////////////////////////////////////////////////////////////////////////////////*/
  @media screen and (max-width: 770px) {
  
      /*PAGE LAYOUT =================================================================*/
      /*Content Container*/.content {
          padding: 20px;
      }
  
  
      /*PAGES ======================================================================*/
      /*Contact Page*/    
      #contactDetails, #contactForm {
          width: 100%;
          padding: 0;
          margin: 0;
      }
  
      #contactDetails {
          margin-top: 30px;
      }
  
  }
  
  
  
  
  
  /*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
  /* Phones /////////////////////////////////////////////////////////////////////////////////////////////*/
  @media screen and (max-width: 500px) {
  
      /*PAGES ======================================================================*/
      /*Contact Page*/
      #contactDetails-normal {
          display: none;
      }
  
      #contactDetails-smart {
          display: block;
          border-top: 1px solid #CED1D6;
          padding-top: 30px;
      }
  
          #contactDetails-smart a {
              color: #FFFFFF;
              background-color: #49AB8E;
  
              width: 100%;
              padding: 10px 15px;
              margin-bottom: 10px;
  
              border-radius: 3px;
              -moz-border-radius: 3px;
              -webkit-border-radius: 3px;
          }
  
              #contactDetails-smart a:hover, 
              #contactDetails-smart a:active {
                  background-color: #398770;
              }
  
  }
  
  
  
  
  
  /*//////////////////////////////////////////////////////////////////////////////////////////////////////*/
  /* Mini Devices ///////////////////////////////////////////////////////////////////////////////////////*/
  @media only screen and (max-width: 290px) {
  
      #logo-smallScreen {
          display: none
      }
  
  }
  </code></pre>
  
  <p><strong>JavaScript:</strong> </p>
  
  <pre><code>$(document).ready(function() {
  
      //Prevent clicking on .active links
      'use strict'; $('.active').click(function(a) {
          a.preventDefault();
      });
  
      //Smart Navigation
      $(".secondHeader-menuButton").on('touchstart click',  function(e) {
          e.preventDefault();
          $("#page").toggleClass("pageOpen");
          $("#headerWrapper").toggleClass("headerOpen");
          $(this).toggleClass("secondHeader-menuButton-active");
      });
  
      $('.content').on('touchstart click', function() {
          $("#page").removeClass("pageOpen");
          $('#headerWrapper').removeClass('headerOpen');
          $('.secondHeader-menuButton').removeClass("secondHeader-menuButton-active");
      });
  
  }); 
  </code></pre>