如何使Materializecss侧边栏导航打开快速过渡?

时间:2018-11-29 11:25:50

标签: javascript materialize sidebar

我正在使用 Materializecss Sidebarnav。一切正常。但我想使侧边栏打开转换快速。 我试过这个例子: Example

这是我的代码

<ul id="slide-out" class="sidenav">
    <li>
        <div class="user-view">
            <div class="background">
                <img src="images/office.jpg">
            </div>
            <a href="#user">
                <img class="circle" src="images/yuna.jpg">
            </a>
            <a href="#name">
                <span class="white-text name">John Doe</span>
            </a>
            <a href="#email">
                <span class="white-text email">jdandturk@gmail.com</span>
            </a>
        </div>
    </li>
    <li>
        <a href="#!">
            <i class="material-icons">cloud</i>First Link With Icon</a>
    </li>
    <li>
        <a href="#!">Second Link</a>
    </li>
    <li>
        <div class="divider"></div>
    </li>
    <li>
        <a class="subheader">Subheader</a>
    </li>
    <li>
        <a class="waves-effect" href="#!">Third Link With Waves</a>
    </li>
</ul>
<a href="#" data-target="slide-out" class="sidenav-trigger">
    <i class="material-icons">menu</i>
</a>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-alpha.2/js/materialize.min.js"></script>
<script>
    $(document).ready(function () {
        $('.sidenav').sidenav();
    });
</script>

我如何快速快速打开侧边栏导航栏?

1 个答案:

答案 0 :(得分:1)

使用选项inDuration(如您提供的链接所示)。

$(document).ready(function () {
    $('.sidenav').sidenav({inDuration: 100});
});