Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 文档未定义,可以';我不能直接打开_Jquery_Twitter Bootstrap - Fatal编程技术网

Jquery 文档未定义,可以';我不能直接打开

Jquery 文档未定义,可以';我不能直接打开,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,这给我的'文件'是未定义的错误,没有理由!我不能直接打开这个文件 代码如下: var main = function() { $('.icon-menu').click(function() { $('.menu').animate({ left: "0px" }, 200); $('body').animate({ left: "285px" }, 200); }); $('.icon-close').click(func

这给我的'文件'是未定义的错误,没有理由!我不能直接打开这个文件

代码如下:

var main = function() {
  $('.icon-menu').click(function() {
    $('.menu').animate({
      left: "0px"
    }, 200);

    $('body').animate({
      left: "285px"
    }, 200);
  });

  $('.icon-close').click(function() {
    $('.menu').animate({
      left: "-285px"
    }, 200);

    $('body').animate({
      left: "0px"
    }, 200);
  });
};


$(document).ready(main);
这是html:

<html>
  <head>
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
    <link href='css/custom.css' rel='stylesheet'>

  </head>
      <link href="css/bootstrap.min.css" rel="stylesheet">
  <body>

    <div class="menu">

      <div class="icon-close">
      </div>

      <ul>

      </ul>
    </div>

    <!-- Main body -->
    <div class="jumbotron">

      <div class="icon-menu">
        <i class="fa fa-bars"></i>
        Menu
      </div>

     <script src="js/bootstrap.min.js"></script>
     <script src="js.js"></script>
  </body>
</html>

菜单

那有什么问题?我将我的js.js放在根目录中,其余的都放在文件夹中。

在使用jquery之前,必须包含jquery:

<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>


您在哪里调用jQuery脚本?它丢失了,因此您出现了错误:)您必须在编写jquery脚本之前加载jquery库,请将它添加到脚本上方,错误就会消失。我玩过它,在这期间,我意外地删除了单行代码!!白痴。。。谢谢你的帮助