JQ动画 show hide

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //从左到右改变大小
            $("#div1").toggle(function () {
                $(this).show(2000);
            }, function () {
                $(this).hide(1000);

            });


        });


        $(function () {

            $("#btn").click(function () {

                $("#div1").toggle(function () {
                    $(this).fadeOut();
                }, function () {
                    $(this).fadeIn();
                });
            });
        });
    </script>
</head>
<body>
    <div id="div1" style="background-color: Red;">
        上的发生的发生法 上的发生的发生法 上的发生的发生法 上的发生的发生法<br />
        上的发生的发生法 上的发生的发生法 上的发生的发生法 上的发生的发生法<br />
        上的发生的发生法 上的发生的发生法 上的发生的发生法 上的发生的发生法
    </div>
    <input type="button" id="btn" value="点击" />
</body>
</html>

 

posted @ 2014-05-21 21:34  编程猴子  阅读(356)  评论(0编辑  收藏  举报