-
Notifications
You must be signed in to change notification settings - Fork 1
/
ng-slide-velocity.js
64 lines (62 loc) · 1.48 KB
/
ng-slide-velocity.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @license Alberto Cole v0.0.1
* (c) 2012-2014 Amatista Digital
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
//We are setting the animation as the device with divided by 2
var animDuration = $(window).width() / 2,
easingType = 'ease';
angular.module('ngSlideVelocity',[])
.animation('.slide-velocity-previous', function() {return {
enter: function(element,done){
$(element).css({
right:'',
left:'-100%'
}).velocity({left:'0'},{
easing:easingType,
duration:animDuration,
complete:function(){
done();
}
});
},
leave: function(element,done){
$(element).css({
right:'',
left:'0'
}).velocity({left:'100%'},{
easing:easingType,
duration:animDuration,
complete:function(){
done();
}
});
}};
})
.animation('.slide-velocity-next', function() {return {
enter: function(element,done){
$(element).css({
left:'',
right:'-100%'
}).velocity({right:'0'},{
easing:easingType,
duration:animDuration,
complete:function(){
done();
}
});
},
leave: function(element,done){
$(element).css({
left:'',
right:'0'
}).velocity({right:'100%'},{
easing:easingType,
duration:animDuration,
complete:function(){
done();
}
});
}};});
})(window, window.angular);