css3 的shake效果,css3抖动窗口 大部分手机浏览器都支持

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript">
$(function(){
	$("ul li").click(function(){
		$("#btn").removeClass().addClass("shake");
		var set = setTimeout(function(){
			$("#btn").removeClass();	
		},1500)
	})
})
</script>
<style type="text/css">
li{border:1px solid #333;}

@-webkit-keyframes shake {

	0%, 100% {-webkit-transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {-webkit-transform: translateX(-10px);}
	20%, 40%, 60%, 80% {-webkit-transform: translateX(10px);}
}
@-moz-keyframes shake {
	0%, 100% {-moz-transform: translateX(0);}
	10%, 30%, 50%, 70%, 90% {-moz-transform: translateX(-10px);}
	20%, 40%, 60%, 80% {-moz-transform: translateX(10px);}
}



a.shake{
	-webkit-animation-name:shake;
	-webkit-animation-duration:1s;
	-moz--name:shake;
	-moz-animation-duration:1s;
	}

a#btn{
	display:block;
	padding:10px;
	width:100px;
	height:50px;
	line-height:50px;
	background:rgba(0,102,255,1);
	-webkit-box-shadow:1px 1px 4px rgba(102,102,102,1);
	-moz-box-shadow:1px 1px 4px rgba(153,153,153,1);
	text-align:center;
	font-weight:bold;
	-webkit-text-shadow:2px 2px 1px rgba(51,51,51,1);
	-moz-text-shadow:2px 2px 1px rgba(51,51,51,1);
	text-shadow:2px 2px 1px rgba(51,51,51,1);
	color:#FFFFFF;
	text-decoration:none;
	border-radius:5px;
	}

</style>
</head>

<body>
<a href="" id="btn" class="">button</a>
<ul>
	<li>111111</li>
	<li>22222</li>
	<li>33333</li>
	<li>44444</li>
	<li>55555</li>
	<li>66666</li>
</ul>
</body>
</html>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值