【问题标题】:Laravel - Bootstrap's JavaScript requires jQuery errorLaravel - Bootstrap 的 JavaScript 需要 jQuery 错误
【发布时间】:2018-04-06 22:03:11
【问题描述】:

在我的 laravel 项目中从引导 css 添加导航栏时,下拉菜单出现问题...菜单没有级联。从浏览器检查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> 

任何人都可以帮我解决这个问题......虽然已经用谷歌搜索并发现这个问题应该在 bootstrap3.3.7 版中得到照顾,但没有运气......

【问题讨论】:

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


    【解决方案1】:

    你必须在加载 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

    【讨论】:

      猜你喜欢
      • 2023-03-31
      • 2015-11-16
      • 2017-11-10
      • 2017-10-19
      • 2023-03-11
      • 2020-08-16
      • 1970-01-01
      • 1970-01-01
      • 2016-12-14
      相关资源
      最近更新 更多