简体   繁体   English

像Google Android和You Tube这样的Material Design Lite导航抽屉

[英]Material design Lite navigation drawer like google Android and You Tube

I, am using Material design lite in my website. 我在我的网站上使用Material Design Lite。 Their are many templates that works great. 他们有很多效果很好的模板。 I, want to change little bit design for navigation drawer. 我,想更改导航抽屉的一点设计。 Here is the template I am using for dashboard 这是我用于仪表板的模板

https://getmdl.io/components/index.html#layout-section https://getmdl.io/components/index.html#layout-section

In this design the navigation drawer is overlap to the nab bar. 在这种设计中,导航抽屉与导航栏重叠。 I want the design to be like google official android website and you tube. 我希望设计像Google官方android网站一样,然后您管。

Here is the design from the android and you tube 这是Android的设计,你管

你管网站

android网站设计

Here is the my design 这是我的设计

我的网站设计

Here is the code for the template. 这是模板的代码。

<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
  <header class="mdl-layout__header">
    <div class="mdl-layout__header-row">
      <!-- Title -->
      <span class="mdl-layout-title">Title</span>
      <!-- Add spacer, to align navigation to the right -->
      <div class="mdl-layout-spacer"></div>
      <!-- Navigation. We hide it in small screens. -->
      <nav class="mdl-navigation mdl-layout--large-screen-only">
        <a class="mdl-navigation__link" href="">Link</a>
        <a class="mdl-navigation__link" href="">Link</a>
        <a class="mdl-navigation__link" href="">Link</a>
        <a class="mdl-navigation__link" href="">Link</a>
      </nav>
    </div>
  </header>
  <div class="mdl-layout__drawer">
    <span class="mdl-layout-title">Title</span>
    <nav class="mdl-navigation">
      <a class="mdl-navigation__link" href="">Link</a>
      <a class="mdl-navigation__link" href="">Link</a>
      <a class="mdl-navigation__link" href="">Link</a>
      <a class="mdl-navigation__link" href="">Link</a>
    </nav>
  </div>
  <main class="mdl-layout__content">
    <div class="page-content"><!-- Your content goes here --></div>
  </main>
</div>

Can anyone please let me know how can I design the navigation drawer like android and you tube. 任何人都可以让我知道如何设计像android这样的导航抽屉吗?

This should do it: 应该这样做:

.mdl-layout--fixed-header>.mdl-layout__header {
  z-index: 6;
}

.has-drawer .mdl-layout__drawer {
  padding-top: 64px;
}

.mdl-layout--fixed-drawer:not(.is-small-screen)>.mdl-layout__header {
  padding-left: 240px;
  margin-left: 0;
  width: 100%;
}

Demo: https://codepen.io/andrei-gheorghiu/pen/XZdQpo 演示: https : //codepen.io/andrei-gheorghiu/pen/XZdQpo

Note: there might be some classes for it, but for me it was easier to provide the CSS than search through docs and example. 注意:可能有一些类,但是对我来说,提供CSS比通过文档和示例搜索要容易。 In the end, researching before asking should have been your task, not mine. 最后,在问之前进行研究应该是您的任务,而不是我的任务。

Cheers! 干杯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM