Search code examples
jqueryhtmlcssmaterialize

Side nav collapse button


The side navigation is not aligned, I have been following the documentation on the framework. See the picture here.

enter image description here

While the expected results is this:

enter image description here

Can you please help me on why it is not aligning?

The HTML:

<!DOCTYPE html>
<html>
<head>

     <!--Import Google Icon Font-->
      <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

      <!--Import materialize.css-->
      <link type="text/css" rel="stylesheet" href="<?php echo base_url();?>assets/css/materialize.css"  media="screen,projection"/>

      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Staff Lounge</title>
</head>

<body>
    <header><!--POI 1-->
        <nav class="top-nav">
            <div class="container">
                <div class="nav-wrapper"><a class="page-title">Administrators Panel</a></div>
            </div>
        </nav>


<div class="container"><!--POI 2-->
    <a href="#" data-activates="nav-mobile" class="button-collapse top-nav full hide-on-large-only">
        <i class="mdi-navigation-menu"></i>
    </a>
</div>

<ul id="nav-mobile" class="side-nav fixed"> <!--POI 3-->
    <li class="bold"><a href="<?php echo base_url();?>admin/dashboardMain" class="waves-effect waves-teal">Main</a></li>
    <li class="bold"><a href="<?php echo base_url();?>admin/dashboardAbout" class="waves-effect waves-teal">About</a></li>
    <li class="no-padding">
        <ul class="collapsible collapsible-accordion">
            <li class="bold"><a class="collapsible-header  waves-effect waves-teal">CSS</a>
                <div class="collapsible-body">
                    <ul>
                        <li><a href="color.html">Color</a></li>
                        <li><a href="grid.html">Grid</a></li>
                        <li><a href="helpers.html">Helpers</a></li>
                        <li><a href="media-css.html">Media</a></li>
                        <li><a href="sass.html">Sass</a></li>
                        <li><a href="shadow.html">Shadow</a></li>
                        <li><a href="table.html">Table</a></li>
                        <li><a href="typography.html">Typography</a></li>
                    </ul>
                </div>
            </li>
        </ul>
    </header>


   <main>
             <div class="container">
                    <div class="row">

            <div class="col s12 m9 l10">

              <div id="structure">
                <h4>Main Dashboard</h4>
                <p class="caption">Please Logout after using the staff accounts</p>
              </div>
          </div>
        </div>
     </main> 

    <footer class="page-footer  grey darken-3">
    <div class="footer-copyright">
        <div class="container">
        </div>

    </div>
</footer>

<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/materialize.min.js"> </script>


<script type="text/javascript">

    $(document).ready(function(){
// Initialize collapse button
$(".button-collapse").sideNav();
// Initialize collapsible (uncomment the line below if you use the dropdown variation)
$('.collapsible').collapsible();



});


</script>
</body>
</html>

CTRL F POI 1 - below it is where the collapsable should be aligned POI 2 - should be the one that is activating the minimized sidenav when browser is minimized POI 3 - contents of the side nav

Can you help here? I've looked at materialize's code and I just implemented it on mine but I do not know why it is not aligning.


Solution

  • So it turns out some classes were not included in the css that I initialized, I don't know why the dev team removed it.

    Here's the one that I initialized to make it work.

    http://materializecss.com/css/ghpages-materialize.css