jQuery的常用动画

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

html

<div id="content">
    <input id="testhide" type="button" value="隐藏">
    <input id="testshow" type="button" value="显示">
    <input id="testtoggle" type="button" value="隐藏/显示">
    <input id="testslideup" type="button" value="上滑隐藏">
    <input id="testslidedown" type="button" value="下滑显示">
    <input id="testslidetoggle" type="button" value="上/下滑显示">
    <input id="testfadein" type="button" value="淡入显示">
    <input id="testfadeout" type="button" value="淡出显示">
    <input id="testfadetoggle" type="button" value="淡入/出显示">
    <input id="testanimate" type="button" value="自定义显示">
    <div id="first">
        想要做一件事,永远都不要怕晚。只要你开始做了,就不晚。而若是你不开始,仅仅停留在思考、犹豫甚至焦虑的状态,那就永远都是零。
    </div>
</div>

css

#content #first {
	color:white;
	background-color:green;
	width:240px;
	height:100px;
	margin:10px 0 0 0;
	padding:10px;
}

js

$(document).ready(function() {
    $("#testhide").click(function() {
        // 动画效果
        $("#first").hide("slow");
    });
    $("#testshow").click(function() {
        // 动画效果
        $("#first").show("slow");
    });
    $("#testtoggle").click(function() {
        // 动画效果
        $("#first").toggle("slow");
    });
    $("#testslideup").click(function() {
        // 动画效果
        $("#first").slideUp("slow");
    });
    $("#testslidedown").click(function() {
        // 动画效果
        $("#first").slideDown("slow");
    });
    $("#testslidetoggle").click(function() {
        // 动画效果
        $("#first").slideToggle("slow");
    });
    $("#testfadein").click(function() {
        // 动画效果
        $("#first").fadeIn("slow");
    });
    $("#testfadeout").click(function() {
        // 动画效果
        $("#first").fadeOut("slow");
    });
    $("#testfadetoggle").click(function() {
        // 动画效果
        $("#first").fadeToggle("slow");
    });
    $("#testanimate").click(function() {
        // 动画效果
        $("#first").animate({
            fontSize: "12px"
        }, "slow");
    });
});

摘自:http://www.jq22.com/webqd2377

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值