cicecice1 发表于 2013-2-7 14:34:37

jquery stop动画的使用

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无档</title>
<script src="jq.js" type="text/javascript"></script>
<script src="js.js" type="text/javascript"></script>
</head>
<style>
#menu{
width:300px;
}
.haschildren{
padding:3px;
background-color:#999;
margin-bottom:11px;
}
div a{
z-index:-11px;
background:#666;
display:none;
float:left;
width:300px;
}
</style>
<body>
<div id="menu">
<div class="haschildren">
         <span>第一章</span>
      <a>javascript</a>
      <a>加入</a>
      <a>编写方法</a>
      <a>小结</a>
    </div>
    <div class="haschildren">
   <span>第二章</span>
    <a>jquery选择器是什么</a>
    <a>jquery的优势</a>
    <a>jquery选择器</a>
    <a>小结</a>
    </div>
   
</div>

</body>
</html>
$(document).ready(function(){
$(".haschildren").hover(function(){
//清空之前的动画并且把动画之前到末状态
$(this).children("a").stop(true,true).slideDown(511).end()
.siblings().children("a").stop(true,true).slideUp(111);

},function(){
    $(this).stop(true,true);
   $(this).children("a").slideUp(1111);
})

});
http://xinwenmm.co.cc
页: [1]
查看完整版本: jquery stop动画的使用