jquery没有工作脚本

时间:2015-08-09 22:16:26

标签: jquery twitter-bootstrap

大家好我对jquery有点新鲜,我不知道为什么我的脚本无法工作,请你帮帮我。我试过了

  

script src =" text / javascript scipt src =' jquery-ui / jquery.min.js and   的jquery-ui.min.js

不知道是否有必要。

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Store Home</title>
<!--Bootstrap-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

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

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!--Bootstrap-->
<script type="text/javascript"></script>
 <script>
 $(document).ready(function() {
    $('#searchbox').hide();
$('#search').mouseOver(function() {
    $('#searchbox').slideToggle(400);
});// end mouseover
 });// end ready
 </script>
</head>
<body>
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">

    </div>
    <div>
      <ul class="nav navbar-nav" id="navbar">
        <li><a href="#" id="log">Login/Register</a></li>
        <li><a href="#" id="home">Home</a></li>
        <li><a href="#" id="search">Search</a></li>
        <li><a href="#" id="store">Store</a></li>
        <li><a href="#" id="about">About</a></li>

      </ul>
    </div>
  </div>
</nav>
 <img src="http://www.unixstickers.com/image/cache/data/stickers/meme/gentleman/Gentleman.sh-600x600.png" href="#" id="logo">

 <div id="searchbox"></div>
    <form class="searchbox" action="">
        <input type="search" placeholder="Search" />

    </form>

</body>
</html>

1 个答案:

答案 0 :(得分:2)

您需要链接jquery脚本,与下面的代码相同,此外,jquery区分大小写,因此请使用mouseover代替mouseOver

$(document).ready(function() {
    $('#searchbox').hide();
$('#search').mouseover(function() {
    $('#searchbox').slideToggle(400);
});// end mouseover
 });// end ready
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Store Home</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

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

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

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!--Bootstrap-->
<script type="text/javascript"></script>
 <script>
 
 </script>
</head>
<body>
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">

    </div>
    <div>
      <ul class="nav navbar-nav" id="navbar">
        <li><a href="#" id="log">Login/Register</a></li>
        <li><a href="#" id="home">Home</a></li>
        <li><a href="#" id="search">Search</a></li>
        <li><a href="#" id="store">Store</a></li>
        <li><a href="#" id="about">About</a></li>

      </ul>
    </div>
  </div>
</nav>
 <img src="http://www.unixstickers.com/image/cache/data/stickers/meme/gentleman/Gentleman.sh-600x600.png" href="#" id="logo">

 <div id="searchbox">Search text</div>
    <form class="searchbox" action="">
        <input type="search" placeholder="Search"/>

    </form>

</body>
</html>