JQ animation 用法

1.参数形式,{},单个多个都是{}
2.绝对值,相对值,百分比
3.单位 有px 无 px
4.动画时间,动画函数
5.属性值toggle

1.参数形式 {}
有时间的话就是{},time-duration
单位:“200px” <==> 数字 200

	$(".box").animate({
			"width": 400
		}, 1000).animate({
			"height": 400
		}, 1000).animate({
			left: "100px",top:100//单位两种都可以
		}, 1000);
		//animate可以写链式操作,而且是同步的

2.相对值写法必须是字符串
$(".box").animate({“width”: “+=400px”},1000);
$(".box").animate({“width”: “+=200”},1000);

3.延时有两种写法
链式写在animate后面,写在回调函数里面
4.animate不支持transform
可以写在回调函数里面

	$(".box").animate({
			"width": "+=200"
		},1000).delay(1000).animate({
			"height":"+=200px"
		},1000,function(){
			$(this).delay(1000);
	$(this).css({'transition':'2s',width:'300px','height':'300px','transform':'rotate(180deg)'});
		});

5.时间函数

$("ul li").hover(function() {
			var $index = $(this).index();
			var $width = $(this).width();
			var $pos = $index * $width;
			$("span").stop(true, true).animate({
				"left": $pos
			}, {
				duration: 2000,
				easing: "easeOutExpo"
			});
		});

$(this).animate({height:“toggle”});

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值