javascript之jquery 动画

11 篇文章 0 订阅
11 篇文章 0 订阅

show()和hide()控制显示和隐藏

$("#panel h5.head").toggle(function(){
        $(this).next().hide();
        },function(){
        $(this).next().show();
        })
$("#panel h5.head").toggle(function(){
        $(this).next().hide(600);
        },function(){
        $(this).next().show(600);
        })
$("#panel h5.head").toggle(function(){
        $(this).next().fadeOut();
        },function(){
        $(this).next().fadeIn();
        })
$("#panel h5.head").toggle(function(){
        $(this).next().slideUp();
        },function(){
        $(this).next().slideDown();
        })
$("#panel").click(function(){
        $(this).animate({left: "500px"}, 3000);
        })
$("#panel").click(function(){
        $(this).animate({left: "500px",height:"200px"}, 3000);
        })
$(function(){
        $("#panel").css("opacity", "0.5");//ÉèÖò»Í¸Ã÷¶È
        $("#panel").click(function(){
            $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000)
            .animate({top: "200px" , width :"200px"}, 3000 )
            .fadeOut("slow");
            });
        });
$(function(){
        $("#panel").css("opacity", "0.5");//设置不透明度
        $("#panel").click(function(){
            $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000)
            .animate({top: "200px" , width :"200px"}, 3000 )
            .css("border","5px solid blue");
            });
        });
$(function(){
        $("#panel").css("opacity", "0.5");//设置不透明度
        $("#panel").click(function(){
            $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000)
            .animate({top: "200px" , width :"200px"}, 3000 )
            .queue(function(next){
                $(this).css("border","5px solid blue");
                next(); //继续下一个动画
                })
            .slideUp("slow");

            });
        });
$(function(){
        $("#panel").css("opacity", "0.5");//设置不透明度
        $("#panel").click(function(){
            $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000)
            .animate({top: "200px" , width :"200px"}, 3000 ,function(){
                $(this).css("border","5px solid blue");
                })

            });
        });
$(function(){
        //给id为mover的元素添加动画.
        function animateIt() {
        $("#mover").slideToggle("slow", animateIt);
        }
        function animateIt2() {
        $("#mover").fadeToggle("slow", animateIt2);
        }
        animateIt();


        $("button").click(function(){
            if(!$('#mover').is(":animated")){		//判断元素是否正处于动画状态
            //如果当前没有进行动画,则添加新动画 
            $('#mover').fadeToggle("slow", animateIt2);
            }else{
            $('#mover').stop();
            }
            });

        });
$(function(){
        $("#panel").css("opacity", "0.5");//设置不透明度
        $("#panel").click(function(){
            $(this).animate({left: "400px", height:"200px" ,opacity: "1"}, 3000)
            .delay(1000)
            .animate({top: "200px" , width :"200px"}, 3000 )
            .delay(2000)
            .fadeOut("slow");
            });
        });
$(function(){
        $("#panel h5.head").click(function(){
            $(this).next().toggle();
            })
        })
$(function(){
        $("#panel h5.head").click(function(){
            $(this).next().fadeTo(600, 0.2);
            })
        })
$(function(){
        $("#panel h5.head").click(function(){
            $(this).next().fadeToggle();
            })
        })
$(function(){
        $("button:eq(0)").click(function () {
            $("div.content").hide().animate({ opacity : "1" }  );
            });

        $("button:eq(1)").click(function () {
            $("div.content").animate({height : "show" , width : "show" , opacity : "show" } , 600 );
            });

        $("button:eq(2)").click(function () {
            $("div.content").animate({height : "show" } , 600 );
            });

        $("button:eq(3)").click(function () {
            $("div.content").animate({ opacity : "show" } , 600 );
            });

        $("button:eq(4)").click(function () {
            $("div.content").animate({ opacity : "0.2" } , 600 );
            });
        })
$(function(){
        $("#panel").hover(function() {
            $(this).stop()
            .animate({height : "150" } , 200 )
            .animate({width : "300" } , 300 )
            },function() {
            $(this).stop()
            .animate({height : "22" } , 200 )
            .animate({width : "60" } , 300 )
            });
        });


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值