Bootstrap导航栏不会在移动设备上缩小

时间:2016-03-07 15:59:56

标签: javascript jquery html css twitter-bootstrap

如果我只是缩小Chrome中的窗口,navbar将按预期工作,但当我进入Chrome的设备模拟器时,navbar永远不会更改为切换按钮。

<nav id="mainNav" class="navbar navbar-default navbar-fixed-top affix-top" style="border:0;background-color:transparent;position:absolute;">
    <div class="container-fluid" style="padding: 20px 15% 0;">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand page-scroll" href="#page-top"><img class="img-responsive" src="/logo.png"></a>
        </div>
        <div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1" aria-expanded="false" style="height: 1px;">
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a class="page-scroll" href="#about">
                        <span>Rewards</span>
                    </a>
                </li>
                <li>
                    <a class="page-scroll" href="#services">
                        <span>Member Care</span>
                    </a>
                </li>
                <li>
                    <a class="page-scroll" href="#portfolio">
                        <span>Sign Up</span>
                    </a>
                </li>
                <li>
                    <a class="page-scroll login-btn" href="#login-form">
                        Log In <i class="fa fa-user"></i>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</nav>

1 个答案:

答案 0 :(得分:4)

您可以先确认您已在页面的头部设置了视口元标记

res.end()