Laravel - Bootstrap的JavaScript需要jQuery错误

时间:2017-10-25 17:39:12

标签: jquery twitter-bootstrap laravel twitter-bootstrap-3

在我的laravel项目中从bootstrap css添加navbar时,我遇到了Dropdown菜单的问题......菜单没有得到级联。从浏览器检查html元素时发现以下错误...

  

Bootstrap的JavaScript需要jQuery错误

以下是CDN,我在我的主文件中使用过......

<head>
<meta charset="uth-8">
<title>@yield('title')</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">

</head>
<body>
@include('layouts.partials.header')
@yield('content')
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
 </body> 

任何人都可以帮我解决这个问题...虽然已经用Google搜索过,发现这个问题应该在bootstrap3.3.7版本中处理,但没有运气......

1 个答案:

答案 0 :(得分:0)

你必须在加载Bootstrap JS之前加载jQuery ...而不是Bootstrap JS两次!

<head>
<meta charset="utf-8">
<title>@yield('title')</title>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">

</head>
<body>
@include('layouts.partials.header')
@yield('content')
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
 </body> 

它的utf-8不是uth-8