始终在materializecss中显示汉堡包菜单

时间:2016-04-27 02:39:30

标签: javascript jquery html css materialize

如何在navbar materializecss上始终显示菜单图标?就像点击时一样,抽屉出现并隐藏反之亦然。

HTML:

<nav class="default" role="navigation">
    <div class="nav-wrapper">
      <a href="#!" class="brand-logo center">Brand</a>
      <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
      <ul class="right hide-on-med-and-down">
        <li><a href="#">Login</a></li>
        <li><a class="waves-effect red waves-light btn">Sign up</a></li>
      </ul>
      <ul class="side-nav" id="mobile-demo">
        <li><a href="#">Login</a></li>
        <li><a href="#">Sign up</a></li>
      </ul>
    </div>
  </nav>

JS:

$('.button-collapse').sideNav({
      menuWidth: 300, // Default is 240
      edge: 'left', // Choose the horizontal origin
      closeOnClick: true // Closes side-nav on <a> clicks, useful for Angular/Meteor
    }
  );

1 个答案:

答案 0 :(得分:9)

在线,

<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>,再添加一个课程.show-on-large

<强> jsfiddle

有关详细信息:Full Screen HTML Structure