六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 63|回复: 0

jquery stop动画的使用

[复制链接]

升级  6.33%

67

主题

67

主题

67

主题

举人

Rank: 3Rank: 3

积分
219
 楼主| 发表于 2013-2-7 14:34:37 | 显示全部楼层 |阅读模式
<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
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表