-
Notifications
You must be signed in to change notification settings - Fork 28
/
sm-transition.js
40 lines (31 loc) · 998 Bytes
/
sm-transition.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
(function(app)
{
// Transitions: scale, fade, flip, drop, fly, swing, browse, slide, jiggle, flash, shake, pulse, tada, bounce
app
.factory('SemanticTransitionLink', ['SemanticUI', SemanticTransitionLink])
.directive('smTransition', ['SemanticTransitionLink', SemanticTransition])
;
function SemanticTransition(SemanticTransitionLink)
{
return {
restrict: 'A',
scope: {
smTransition: '@',
smTransitionEvents: '@',
smTransitionOther: '@'
},
link: SemanticTransitionLink
};
}
function SemanticTransitionLink(SemanticUI)
{
return function(scope, element, attributes)
{
scope.smTransitionEvents = scope.smTransitionEvents || 'click';
element.on( scope.smTransitionEvents, function()
{
( scope.smTransitionOther ? $( scope.smTransitionOther ) : element ).transition( scope.smTransition );
});
};
}
})( angular.module('semantic-ui-transition', ['semantic-ui-core']) );