滚动导航栏在Material Design Lite v1.0.5中不起作用

时间:2015-10-28 19:43:21

标签: javascript jquery html css material-design

我使用Material Design Lite制作网站导航栏。但是看起来菜单的滚动在Chrome和Safari中并不适用于鼠标,但在Mozilla Firefox中它是可以的。

<html>
  <head>
    <!-- Material Design Lite -->
    <script src="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.min.js"></script>
    <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.indigo-pink.min.css">
    <!-- Material Design icon font -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  </head>
  <body>
    <!-- Uses a header that scrolls with the text, rather than staying
      locked at the top -->
    <div class="mdl-layout mdl-js-layout">
      <header class="mdl-layout__header mdl-layout__header--scroll">
        <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 -->
          <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>
      </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>
  </body>
</html>

这是codepen:https://codepen.io/anon/pen/qOYKXK

有谁知道我怎么能让这个卷轴工作?

1 个答案:

答案 0 :(得分:0)

将脚本版本从1.0.5更改为1.0.2对我有用。

所以在你的头标改变

<script src="https://storage.googleapis.com/code.getmdl.io/1.0.5/material.min.js"> </script>

<script src="https://storage.googleapis.com/code.getmdl.io/1.0.2/material.min.js"></script>

滚动功能似乎从v1.0.3开始打破。我不知道是什么原因引起了这个问题。如果你发现了,请在这里发布答案,我想知道:)