首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

jquery的特效实现?解决方案

2012-06-15 
jquery的特效实现???script srcfile:///D|/jquery/jquery-1.3.2.js typetext/javascript/script

jquery的特效实现???
<script src="file:///D|/jquery/jquery-1.3.2.js" type="text/javascript"></script>
<script>
  $("has_childern").click(function(){
$(this).addClass("highlight")
.children("a").show().end()
.siblings().removeClass("highlight").children("a").hide();
});
</script>
  <style type="text/css">
  #menu{ width:300px;}
.has_childern{ background:#000; color:#fff; cursor: pointer}
.highlight{ color:#fff; background: green;}
div{ padding:0; margin:10px 0;}
div a{ background:#888; display:none; float:left; width:300px;}
 
  </style>
</head>

<body>
  <div id="menu">
  <div class="has_childern">
  <span>服装设计</span>
  <a>1、绘描</a>
  <a>2、ps</a>
  <a>3、色彩学</a>
  </div>
  <div class="has_childern">
  <span>美食</span>
  <a>1、炒菜类</a>
  <a>2、煨汤类</a>
  <a>3、蒸食类</a>
  </div>
  <div class="has_childern">
  <span>外语</span>
  <a>1、英语</a>
  <a>2、日语</a>
  <a>3、德语</a>
  </div>
   
  </div>
</body>

为什么没有反应呢??各位救救我?

[解决办法]
<script>
$(document).ready(function () {
$(".has_childern").click(function () {

$(this).addClass("highlight").children("a").show().end().siblings().removeClass("highlight").children("a").hide();
});
})

</script>

热点排行