gpt4 book ai didi

jquery - Bootstrap 3 导航栏切换按钮没有功能

转载 作者:行者123 更新时间:2023-11-28 06:08:26 24 4
gpt4 key购买 nike

我正在使用最新版本的 Bootstrap 3,我已经为我的网站制作并定制了一个导航栏 that can be found here .我似乎无法找到为什么,当我将浏览器窗口调整为移动设备大小时,折叠按钮不起作用。你能找出为什么按钮不起作用吗?

@import url('https://fonts.googleapis.com/css?family=Dosis');
@import url('https://fonts.googleapis.com/css?family=Raleway');
@import url('https://fonts.googleapis.com/css?family=Montserrat');
body {
font-family: Raleway;
}
footer {
background-color: #000000;
color: #ffffff;
text-align: center;
padding: 5px;
}
#main-menu.navbar-default .navbar-brand {
color: rgba(255, 255, 255, 1);
font-family: Montserrat;
font-size: 90%;
}
#main-menu.navbar-default {
font-size: 17px;
background-color: rgba(0, 153, 255, 1);
border-bottom-width: 0px;
font-family: Montserrat;
font-size: 90%;
}
#main-menu.navbar-default .navbar-nav>li>a {
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 153, 255, 1);
}
#main-menu.navbar-default .navbar-nav>li>a:hover,
#main-menu.navbar-default .navbar-nav>li>a:focus {
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 170, 255, 1);
}
#main-menu.navbar-default .navbar-nav>.active>a,
#main-menu.navbar-default .navbar-nav>.active>a:hover,
#main-menu.navbar-default .navbar-nav>.active>a:focus {
color: rgba(255, 255, 255, 1);
background-color: rgba(64, 179, 255, 1);
}
#main-menu.navbar-default .navbar-toggle {
border-color: #0066cc;
color: #0099ff;
}
#main-menu.navbar-default .navbar-toggle:hover,
#main-menu.navbar-default .navbar-toggle:focus {
background-color: #0066cc;
color: #0099ff;
}
#main-menu.navbar-default .navbar-toggle .icon-bar {
background-color: #0066cc;
color: #004080;
}
#main-menu.navbar-default .navbar-toggle:hover .icon-bar,
#main-menu.navbar-default .navbar-toggle:focus .icon-bar {
background-color: #0099ff;
color: #004080;
}
<head>
<title>Home Page</title>
<link type="text/css" href="/StyleSheets/ModuleStyleSheets.css" rel="StyleSheet" />
<script type="text/javascript">
var jslang = 'EN';
</script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">


<div id="main-menu" class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a href="index.html" class="pull-left">
<img src="http://www.coding-kids.net/logo.png" width="180px">
</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-menubuilder">
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"><i class="fa fa-home"></i> HOME</a>
</li>
<li><a href="tutorials"><i class="fa fa-code"></i> TUTORIALS</a>
</li>
<li><a href="about"><i class="fa fa-align-justify"></i> ABOUT</a>
</li>
<li><a href="faq"><i class="fa fa-question-circle"></i> FAQs</a>
</li>
<li><a href="contact"><i class="fa fa-comments-o"></i> CONTACT</a>
</li>
</ul>
</div>
</div>
</div>
<div>

</div>
<footer>
&copy; Coding Kids 2016. All rights reserved.
</footer>

</body>

最佳答案

像这样在 Bootstrap 之前包含 jQuery:

@import url('https://fonts.googleapis.com/css?family=Dosis');
@import url('https://fonts.googleapis.com/css?family=Raleway');
@import url('https://fonts.googleapis.com/css?family=Montserrat');
body {
font-family: Raleway;
}
footer {
background-color: #000000;
color: #ffffff;
text-align: center;
padding: 5px;
}
#main-menu.navbar-default .navbar-brand {
color: rgba(255, 255, 255, 1);
font-family: Montserrat;
font-size: 90%;
}
#main-menu.navbar-default {
font-size: 17px;
background-color: rgba(0, 153, 255, 1);
border-bottom-width: 0px;
font-family: Montserrat;
font-size: 90%;
}
#main-menu.navbar-default .navbar-nav>li>a {
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 153, 255, 1);
}
#main-menu.navbar-default .navbar-nav>li>a:hover,
#main-menu.navbar-default .navbar-nav>li>a:focus {
color: rgba(255, 255, 255, 1);
background-color: rgba(0, 170, 255, 1);
}
#main-menu.navbar-default .navbar-nav>.active>a,
#main-menu.navbar-default .navbar-nav>.active>a:hover,
#main-menu.navbar-default .navbar-nav>.active>a:focus {
color: rgba(255, 255, 255, 1);
background-color: rgba(64, 179, 255, 1);
}
#main-menu.navbar-default .navbar-toggle {
border-color: #0066cc;
color: #0099ff;
}
#main-menu.navbar-default .navbar-toggle:hover,
#main-menu.navbar-default .navbar-toggle:focus {
background-color: #0066cc;
color: #0099ff;
}
#main-menu.navbar-default .navbar-toggle .icon-bar {
background-color: #0066cc;
color: #004080;
}
#main-menu.navbar-default .navbar-toggle:hover .icon-bar,
#main-menu.navbar-default .navbar-toggle:focus .icon-bar {
background-color: #0099ff;
color: #004080;
}
<head>
<title>Home Page</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<link type="text/css" href="/StyleSheets/ModuleStyleSheets.css" rel="StyleSheet" />
<script type="text/javascript">
var jslang = 'EN';
</script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css">
<meta name="viewport" content="width=device-width, initial-scale=1">


<div id="main-menu" class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a href="index.html" class="pull-left">
<img src="http://www.coding-kids.net/logo.png" width="180px">
</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse navbar-menubuilder">
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"><i class="fa fa-home"></i> HOME</a>
</li>
<li><a href="tutorials"><i class="fa fa-code"></i> TUTORIALS</a>
</li>
<li><a href="about"><i class="fa fa-align-justify"></i> ABOUT</a>
</li>
<li><a href="faq"><i class="fa fa-question-circle"></i> FAQs</a>
</li>
<li><a href="contact"><i class="fa fa-comments-o"></i> CONTACT</a>
</li>
</ul>
</div>
</div>
</div>
<div>

</div>
<footer>
&copy; Coding Kids 2016. All rights reserved.
</footer>

</body>

关于jquery - Bootstrap 3 导航栏切换按钮没有功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36328990/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com