当我使用本地文件时,为什么我会丢失启动下拉菜单
Why do I lose Bootstrap Dropdown Menus when I use local files?
我已经使用Bootstrap一年了,它运行得很好。但当我尝试在本地使用这些文件时,结果总是一样的:我的导航栏下拉菜单停止下拉。
有人看到我做错了什么吗?
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<!-- Place favicon.ico in the root directory -->
<script src="js/jquery.min.js"></script>
<script src="js/plugins.js"></script>
<script src="js/jquery-ui-1.11.4/jquery-ui.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="js/bootstrap.min.js"></script>
错误为:
wsschedulepolygraphs.php:14 GET http://localhost/dfwit/js/jquery.min.js
wsschedulepolygraphs.php:17 GET http://localhost/dfwit/js/jquery-ui-1.11.4/jquery-ui.min.js
bootstrap.min.js:6 Uncaught Error: Bootstrap's JavaScript requires jQuery(anonymous function) @ bootstrap.min.js:6
dropdown-enhancement.js:267 Uncaught ReferenceError: jQuery is not defined(anonymous function) @ dropdown-enhancement.js:267
wsschedulepolygraphs.php:434 Uncaught ReferenceError: $ is not defined(anonymous function) @ wsschedulepolygraphs.php:434
wsschedulepolygraphs.php:530 Uncaught ReferenceError: $ is not defined
在读取文件时,对目录的不正确权限会导致403和其他访问错误。从命令行检查当前目录的所有者和组:
~$ ls -ld
drwxr-xr-x 2 owner group 4096 Aug 12 19:12 Desktop
来源:如何查找目录的所有者和组
https://superuser.com/a/91966
只要看一下代码,您的引导程序路径就与所有其他JavaScript包含的路径不同。
<script src="js/jquery.min.js"></script>
^^^
<script src="/js/bootstrap.min.js"></script>
^^^
js文件的路径不正确。同样,对于下面的代码,js之前的/可能会导致问题
<script src="/js/bootstrap.min.js"></script>
相关文章:
- 为什么我的控制器没有启动函数.js脚本
- 为什么不'我的窗口滚动事件根本没有启动.其他答案没有解决问题
- 为什么不't在iOS上启动按钮下拉工作
- 为什么我的javascript鼠标事件没有启动
- 为什么首先单击文档空白处的任何位置启动代码,而不是单击超链接,以及为什么打开了太多选项卡
- 为什么这个JS确认窗口没有在表单提交时启动
- 为什么onchange事件没有在第一次更改时启动
- 为什么可以't我在html上启动了我的LibGDX项目
- JavaScript:古代代码使用“new”关键字启动简单对象.为什么
- 为什么列表视图单击处理程序在启动时执行函数
- 为什么Visual Studio Node.js项目使用shebang/bash脚本来启动服务器
- 为什么 Meteor 在使用“”启动 HTML 文件时不渲染任何内容
- 为什么@require jQuery 会在具有 @run-at 文档启动的脚本中抛出错误
- Node.js为什么不立即启动子进程
- 为什么Soundmanager 2没有在firefox中启动加载事件(23)
- 当我使用本地文件时,为什么我会丢失启动下拉菜单
- 为什么不是't我的更改事件启动
- 为什么要用"立即:false”;不会't关闭弹出窗口并启动回调
- 为什么我的ASP.NET按钮控件没有启动JQuery对话框
- 为什么启动我的click()事件似乎有延迟