我目前正在使用JS应用程序和Bootstrap。我网站的索引文件只包含
<div id="app"></div>
和一些脚本。
Now I'm wanting to implement an responsive navbar into the app.js with data-toggle but haven't figured it out yet.
var Navbar = React.createClass({
displayName: 'Navbar',
render: function() {
return el.nav(
{className: 'navbar navbar-inverse navbar-fixed-top'},
el.div(
{className: 'container'},
el.div(
{className: 'navbar-header'},
el.a({className: 'navbar-brand', href:'/'}, config.app_name)
需要做出回应
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
实施了它。如何解决此问题,因为我目前没有找到解决此问题的方法。
答案 0 :(得分:0)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Case</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"> </script>
</head>
<body>
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>
<div class="container">
<h3>Inverted Navbar</h3>
<p>An inverted navbar is black instead of gray.</p>
</div>
</body>
</html>
使用Bootstrap JQuery功能,您不必自己编写