title: responsive mobile nav in materializeCSS how to
body: <p>I've been trying to figure out a way to change the html structure of my web app using media queries so that my nav collapses into a drop down on the mobile site. It seems that the only way to change the actual markup is to use jquery, but I'd like to avoid that if possible. </p>
  
  <p>I've looked all over but all of the suggestions ive tried online just cause more problems than it solves bc im using the materialize css framework for the site. Hopefully someone here has worked with materialize before and has solved the problem already. </p>
  
  <p>Here is the html:</p>
  
  <pre><code>&lt;nav class="nav"&gt;
      &lt;div class="nav-wrapper"&gt;
          &lt;a href="#" class="brand-logo left"&gt;Game Swap&lt;/a&gt;
          &lt;ul id="nav-mobile" class="right"&gt;
              &lt;li&gt;&lt;a id="homeMenu" href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="searchMenu" href="#"&gt;Matches&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="profileMenu" href="#"&gt;Profile&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="loginMenu" href="#"&gt;Login&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="logoutMenu" href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>As of now, the nav works pretty well as all res until you get to about 620px wide, then the nav items start overlapping the logo. </p>
  
  <p><a href="http://materializecss.com/" rel="nofollow noreferrer">Here's the materialize documentation</a> if helpful.</p>
  
  <p>Thanks for any help in advance. </p>
  
  <p>UPDATE: I have succesfully used materialize to replace my nav with a hamburger nav. However, when clicked on desktop, there is no dropdown. It has occurred to me that maybe this hamburger nav is merely a button for mobile for side navigation to animate from the side onto the screen. If not, then there is somethign else wrong with the code. The documentation claims there is an "example below" but I dont see it. See here: <a href="http://materializecss.com/navbar.html#mobile-collapse" rel="nofollow noreferrer">http://materializecss.com/navbar.html#mobile-collapse</a></p>
  
  <p>I have also initialized the jquery line at the end of document ready, so that shouldnt be the issue. </p>
  
  <p>updated HTML:</p>
  
  <pre><code>&lt;nav class="nav"&gt;
      &lt;div class="nav-wrapper"&gt;
          &lt;a href="#" class="brand-logo left"&gt;Game Swap&lt;/a&gt;
          &lt;a href="#" data-activates="mobile-demo" class="button-collapse right"&gt;&lt;i class="material-icons"&gt;menu&lt;/i&gt;&lt;/a&gt;
          &lt;ul id="nav-mobile" class="right hide-on-med-and-down"&gt;
              &lt;li&gt;&lt;a id="homeMenu" href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="searchMenu" href="#"&gt;Matches&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="profileMenu" href="#"&gt;Profile&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="loginMenu" href="#"&gt;Login&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="logoutMenu" href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;ul class="side-nav" id="mobile-demo"&gt;
              &lt;li&gt;&lt;a id="homeMenu" href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="searchMenu" href="#"&gt;Matches&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="profileMenu" href="#"&gt;Profile&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="loginMenu" href="#"&gt;Login&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a id="logoutMenu" href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>UPDATE 2: I decided to make the whole thing a drop down, using a different component altogether. See solution below for anyone with the same issue. </p>
  
  <pre><code>&lt;ul id="dropdown1" class="dropdown-content"&gt;
    &lt;li&gt;&lt;a id="homeMenu" href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a id="searchMenu" href="#"&gt;Matches&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a id="profileMenu" href="#"&gt;Profile&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a id="loginMenu" href="#"&gt;Login&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a id="logoutMenu" href="#"&gt;Logout&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;nav class="nav"&gt;
      &lt;div class="nav-wrapper"&gt;
          &lt;a href="#" class="brand-logo left"&gt;Game Swap&lt;/a&gt;
          &lt;ul class="right"&gt;
              &lt;li&gt;&lt;a class="dropdown-button" href="#!" data-activates="dropdown1"&gt;Menu&lt;i class="material-icons right"&gt;arrow_drop_down&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>