forked from yangxi0126/javaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.html
More file actions
41 lines (41 loc) · 1.19 KB
/
1.html
File metadata and controls
41 lines (41 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="css/animate.min.css">
<style>
*{
margin: 0;
padding: 0;
}
#login{
width: 300px;
height: 300px;
border: 1px solid red;
}
.animated.tada{
-webkit-animation-duration:.3s; /*可以在这里改动画的持续时间,延迟时间和执行次数等*/
}
</style>
</head>
<body>
<div id="login">
<input type="text">
<button>登录</button>
</div>
</body>
<script src="js/jquery-1.9.1.min.js"></script>
<script>
// git地址:https://github.com/daneden/animate.css
$('button').on('click',function(){
var $login=$('#login');
var name= $.trim($('input').val());
if(name==''){
$login.addClass('animated tada').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){
$(this).removeClass('animated tada');
}); //one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend',function(){}相当于回调
}
});
</script>
</html>