gpt4 book ai didi

jquery - Bootstrap 导航栏显示不正确

转载 作者:行者123 更新时间:2023-11-28 17:02:56 24 4
gpt4 key购买 nike

我是 StackOverFlow 社区的新手,希望在未来贡献我自己的解决方案 :-) 现在,我们将不胜感激您的帮助:

这是使用 Bootstrap 的 Wordpress 页面的部分脚本(仅导航栏部分完整)。由于某种原因,它无法在除 Internet Explorer 之外的任何浏览器上正确显示。

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="Description" content="">
<meta name="Author" content="">
<link rel="icon" href="assets/img/favicon.ico">

<title>Test</title>

<!-- Bootstrap core CSS EDITED-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>

<!-- FontAwsome icons -->
<link href="assets/css/font-awesome/css/font-awesome.min.css" rel="stylesheet">

<!-- google fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>

<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

</head>
<body>

<!-- HEADER ======== -->
<header class="site-header" role="banner">

<!-- Navbar -->
<div class="navbar-wrapper">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">

<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="/"><img src="assets/img/logo.png" alt="Boostrap to Wordpress"></a>

</div><!--navbar header -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/">Home</li>
<li><a href="blog.html">Blog</li>
<li><a href="resources.html">Resources</li>
<li><a href="Contact.html">Contact</li>
</ul><!-- nav

<div><!--navbar collapse -->

</div><!-- container -->
</div><!-- navbar -->
</div><!--navbar wrapper -->

</header>

<!-- Section1 ======== -->
<section>
</section>

<!-- sections missing ... -->

<!-- FOOTER ======== -->

<footer>
</footer>

<!-- BOOSTRAP CORE JAVASCRIPT =====EDITED -->
<script assets/js/jquery-2.1.4.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

</body>
</html>

我非常确定 CSS 和 JS 脚本是最新的。

最佳答案

正确包含 Bootstrap 文件并检查它是否已加载并删除对 jquery.js 的多个引用并保留来自 cdn - https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js 或来自您的本地 - assets/js/jquery-2.1.4.min.js

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="Description" content="">
<meta name="Author" content="">
<link rel="icon" href="assets/img/favicon.ico">

<title>Test</title>

<!-- Bootstrap core CSS -->


<!-- FontAwsome icons -->
<link href="assets/css/font-awesome/css/font-awesome.min.css" rel="stylesheet">

<!-- google fonts -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>

<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->

</head>
<body>

<!-- HEADER ======== -->
<header class="site-header" role="banner">

<!-- Navbar -->
<div class="navbar-wrapper">
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">

<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="/"><img src="assets/img/logo.png" alt="Boostrap to Wordpress"></a>

</div><!--navbar header -->
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/">Home</li>
<li><a href="blog.html">Blog</li>
<li><a href="resources.html">Resources</li>
<li><a href="Contact.html">Contact</li>
</ul><!-- nav

<div><!--navbar collapse -->

</div><!-- container -->
</div><!-- navbar -->
</div><!--navbar wrapper -->

</header>

<!-- Section1 ======== -->
<section>
</section>

<!-- sections missing ... -->

<!-- FOOTER ======== -->

<footer>
</footer>

<!-- BOOSTRAP CORE JAVASCRIPT ======== Place at the end of the document so the pages load faster -->



</body>
</html>

关于jquery - Bootstrap 导航栏显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30885973/

24 4 0