0

我是初学者,Jquery我有这个代码

<html>
<head>
<meta charset="UTF-8" />
<title>Photography & Rare Books </title>
<link href="_css/style.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Marcellus+SC' rel='stylesheet' type='text/css'>
<link href="_css/flex/flexslider.css" rel="stylesheet" type="text/css">
<script src="_scripts/flex/modernizr-2.5.2-respond-1.1.0.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#m").hover(function(){
  $("#n").css("visibility","hidden");
  },function(){
  $("#n").css("visibility","visible");
});
}
</script>
</head>
<body>

<div class="sidebar1">
    <div class="kicker">
      <h3>Categories</h3>
    </div>
    <ul class="nav">
      <li><a href="catalog_art.php">Art & Architecture</a> </li>
      <li><a href="catalog_aviation.php">Aviation</a> </li>
      <li><a href="catalog_business.php">Business</a> </li>
      <li><a href="catalog_cartoon.php">Cartoons</a> </li>
      <li><a href="catalog_civilwar.php">Civil War</a> </li>
      <li><a href="catalog_bindings.php">Fine Bindings & Illuminated Manuscripts</a> </li>
      <li id="m"><a  >Fine Photographs</a></li>
      <li id="n"><a href="catalog_photographs_19.php" style="margin-left:2cm; width: 2cm;" >19th century </a></li>
      <li id="n" ><a href="catalog_photographs_20.php" style="margin-left:2cm; width: 2cm;"  >20th century </a></li>


      <li><a href="catalog_hollywood.php">Hollywood</a> </li>
      <li><a href="catalog_judaica.php">Judaica, Civil Rights, Misc.</a> </li>
      <li><a href="catalog_law.php">Law and Outlaws</a> </li>
      <li><a href="catalog_literature.php">Literature</a> </li>
      <li><a href="catalog_maps.php">Maps & Cartography</a> </li>
      <li><a href="catalog_music.php">Music</a> </li>
      <li><a href="catalog_presidents.php">Presidents</a> </li>
      <li><a href="catalog_revolutionarywar.php">Revolutionary War</a> </li>
      <li><a href="catalog_royalty.php">Royalty</a> </li>
      <li><a href="catalog_science.php">Science</a> </li>
      <li><a href="catalog_space.php">Space</a> </li>
      <li><a href="catalog_sports.php">Sports & Hobbies</a> </li>
      <li><a href="catalog_Travel.php">Travel & Exploration</a> </li>
      <li><a href="catalog_wildwest.php">Wild West</a> </li>
      <li><a href="catalog_worldleaders.php">World Leaders</a> </li>
      <li><a href="catalog_worldwar2.php">World War II</a> </li>
    </ul>
   </div>
</body>
</html>

我只想显示子类别,以防将鼠标传递到 categorie <li id="m"><a >Fine Photographs</a></li> <li id="n"><a href="catalog_photographs_19.php" style="margin-left:2cm; width: 2cm;" >19th century </a></li> <li id="n" ><a href="catalog_photographs_20.php" style="margin-left:2cm; width: 2cm;" >20th century </a></li>

但它不起作用。为什么什么都没有发生?我怎样才能修复我的片段?

4

1 回答 1

1

用 CSS 隐藏嵌套的 li。您的 DOM 就绪函数缺少结束括号。

查看链接:http: //jsbin.com/eqotis/1/edit

于 2013-06-08T22:52:35.500 回答