Skip to content

Commit efc303f

Browse files
committed
Animation settings
Add animation effects to auth page validation
1 parent ff6aed8 commit efc303f

7 files changed

Lines changed: 52 additions & 15 deletions

File tree

src/_main/main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,19 @@ NProgress.start();
107107
// end loading bar
108108
NProgress.done();
109109

110+
111+
/***********************************************
112+
* Animation Settings
113+
***********************************************/
114+
115+
function setAnimation(options) {
116+
var animationName = "animated " + options.name;
117+
var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
118+
$(options.selector)
119+
.addClass(animationName)
120+
.one(animationEnd,
121+
function(){
122+
$(this).removeClass(animationName);
123+
}
124+
);
125+
}

src/app/_common/header/nav/nav.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
$('.nav-profile > li > a').on('click', function() {
1+
$(function() {
2+
$('.nav-profile > li > a').on('click', function() {
23

3-
var animationName = "animated flipInX";
4-
var animationEnd = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
5-
6-
$(this).next()
7-
.addClass(animationName)
8-
.one(animationEnd,
9-
function(){
10-
$(this).removeClass(animationName);
11-
}
12-
);
13-
});
4+
var $el = $(this).next();
5+
setAnimation({
6+
name: 'flipInX',
7+
selector: $el
8+
});
9+
});
10+
})

src/auth/auth.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$(function() {
2+
setAnimation({
3+
name: 'pulse',
4+
selector: '.auth-container > .panel'
5+
});
6+
})

src/auth/context.js

Whitespace-only changes.

src/auth/login/login.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ $(function() {
2020
},
2121
password: "Please enter password",
2222
agree: "Please accept our policy"
23-
}
23+
},
24+
invalidHandler: function() {
25+
setAnimation({
26+
name: 'shake',
27+
selector: '.auth-container > .panel'
28+
});
29+
}
2430
}
2531

2632
$.extend(loginValidationSettings, validationDefaultSettings);

src/auth/reset/reset.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ $(function() {
1616
required: "Please enter email address",
1717
email: "Please enter a valid email address"
1818
}
19-
}
19+
},
20+
invalidHandler: function() {
21+
setAnimation({
22+
name: 'shake',
23+
selector: '.auth-container > .panel'
24+
});
25+
}
2026
}
2127

2228
$.extend(resetValidationSettings, validationDefaultSettings);

src/auth/signup/signup.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ $(function() {
7373
minlength: "Passwords should be at least 8 characters."
7474
},
7575
agree: "Please accept our policy"
76-
}
76+
},
77+
invalidHandler: function() {
78+
setAnimation({
79+
name: 'shake',
80+
selector: '.auth-container > .panel'
81+
});
82+
}
7783
}
7884

7985
$.extend(signupValidationSettings, validationDefaultSettings);

0 commit comments

Comments
 (0)