简体   繁体   English

Twitter Bootstrap 3导航栏没有响应

[英]Twitter Bootstrap 3 navigation bar is not responsive

I'm using Twitter Bootstrap 3. I'm writing a simple navbar but is not responsive: if I zoom in the browser the Toggle navigation doesn't work. 我正在使用Twitter Bootstrap3。我正在编写一个简单的导航栏,但没有响应:如果放大浏览器,则Toggle导航将不起作用。 You can copy and paste this html file and zooming with Chrome the toogle doesn't work. 您可以复制并粘贴此html文件,并且使用Chrome缩放时,togleg无法使用。

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/css/bootstrap.min.css">

    <!-- Latest compiled and minified JavaScript -->
    <script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <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" href="/">Title</a>
        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                <li class="active"><a href="/about">About</a></li>
                <li><a href="/">Blog</a></li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

</body>
</html>

Can you help me? 你能帮助我吗?

You are forgetting to include Jquery! 您忘记了包含Jquery! Add this in your head tags. 将此添加到您的头部标签中。

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

I zoom in the browser and the Toggle navigation worked. zoom了浏览器,并且Toggle导航起作用了。 May be some other problem you are facing. 可能是您面临的其他问题。

DEMO DEMO

没有变焦

变焦

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

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