navbar collopse在bootsrap中不起作用

时间:2017-01-21 13:50:37

标签: twitter-bootstrap-3

我正在使用bootstrap开发一个网站。在导航栏区域,崩溃无效。任何人都可以解决这个问题。

 <nav class="navbar navbar-inverse" role="banner">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <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="index.html"><img src="<?php echo base_url();?>assets/images/logo1.png" alt="logo"></a>
                </div>
            <div class="collapse navbar-collapse navbar-right">
                    <ul class="nav navbar-nav">
                        <li><a href="<?php echo base_url();?>clicx_ctrl/index">Home</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/about_us">About Us</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/design">Design</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/services">Services</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/portfolio">Portfolio</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/login">Login</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/register">Register</a></li>
                    </ul>
                </div>
            </div><!--/.container-->
</nav><!--/nav-->

1 个答案:

答案 0 :(得分:2)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
</script>
	</head>
	<body>
	<nav class="navbar navbar-inverse" role="banner">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <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="index.html"><img src="<?php echo base_url();?>assets/images/logo1.png" alt="logo"></a>
                </div>
            <div class="collapse navbar-collapse navbar-right">
                    <ul class="nav navbar-nav">
                        <li><a href="<?php echo base_url();?>clicx_ctrl/index">Home</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/about_us">About Us</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/design">Design</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/services">Services</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/portfolio">Portfolio</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/login">Login</a></li>
                        <li><a href="<?php echo base_url();?>clicx_ctrl/register">Register</a></li>
                    </ul>
                </div>
            </div><!--/.container-->
</nav><!--/nav-->