(056)jquery_动画_toggle

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>animate_toggle.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        div
        {
            margin: 10px 0px;
            border: solid 1px #ccc;
            width: 280px;
        }
        ul
        {
            list-style-type: none;
            padding: 5px;
            margin: 0px;
            display: none;
        }
        li
        {
            margin: 3px;
        }
        h4
        {
            background-color: #eee;
            padding: 5px;
            margin: 0px;
            height: 23px;
            line-height: 23px;
        }
        .fl
        {
            float: left;
        }
        .fr
        {
            float: right;
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery190.js"></script>
    <script type="text/javascript">
        $(function(){
            var $h4 = $("h4");
            var $span = $("#spnTip");
            $h4.bind("click",function(){
                $("ul").toggle(1000,function(){
                    $span.text($span.text() == "显示"?"隐藏":"");
                });
            });
        });
    </script>
  </head>
  
  <body>
        <h4>
           <span class="fl">我喜欢吃的水果</span>
           <span class="fr" id="spnTip">显示</span>
        </h4>
        <ul>
            <li>苹果</li>
            <li>甘桔</li>
            <li></li>
        </ul>
  </body>
</html>

 

posted @ 2014-12-29 12:36  雪中飞雁  阅读(85)  评论(0)    收藏  举报