-
Notifications
You must be signed in to change notification settings - Fork 8
/
qtip2.js
45 lines (39 loc) · 1.09 KB
/
qtip2.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
!function($) {
'use strict';
angular.module('qtip2', [])
.directive('qtip', function() {
return {
restrict: 'A',
scope : {
qtipVisible : '='
},
link: function(scope, element, attrs) {
var my = attrs.qtipMy || 'bottom center'
, at = attrs.qtipAt || 'top center'
, qtipClass = attrs.qtipClass || 'qtip'
, content = attrs.qtipContent || attrs.qtip;
if (attrs.qtipTitle) {
content = {'title': attrs.qtipTitle, 'text': attrs.qtip};
}
$(element).qtip({
content: content,
position: {
my: my,
at: at,
target: element
},
hide: {
fixed : true,
delay : 100
},
style: qtipClass
});
if(attrs.qtipVisible) {
scope.$watch('qtipVisible', function (newValue, oldValue) {
$(element).qtip('toggle', newValue);
});
}
}
}
})
}(window.jQuery);