JS学习-3.练习2

屏幕进行抖动(类似于qq抖动)

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
		#myBody{
			position: absolute;
		}	
		</style>
	</head>
	<body id="myBody">
		屏幕抖动效果
		<script>
		var body=document.body;
		var num=0;
		setInterval(function(){
			num=num+1;
			if(num%4==1){
				body.style.left="3px";
				body.style.top="3px";
			}
			if(num%4==2){
				body.style.left="-3px";
				body.style.top="-3px";
			}
			if(num%4==3){
				body.style.left="3px";
				body.style.top="-3px";
			}
			if(num%4==0){
				body.style.left="-3px";
				body.style.top="-3px";
			}	
		},30);
		</script>
	</body>
</html>
上一篇:utils->frame->vue->elementUI_bug函数集合(工具类函数)


下一篇:input复选框checkbox默认样式修改