-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjrm-perfect-scrollbar.js
More file actions
59 lines (54 loc) · 1.73 KB
/
jrm-perfect-scrollbar.js
File metadata and controls
59 lines (54 loc) · 1.73 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
/**
* @ngdoc directive
* @description
* # jrmPerfectScrollbar
*/
angular.module('mtbInteractiveApp')
.directive('jrmPerfectScrollbar', function ( $timeout ) {
return {
restrict: 'A',
scope: {
includePadding: '@',
maxScrollbarLength: '@',
minScrollbarLength: '@',
scrollXMarginOffset: '@',
scrollYMarginOffset: '@',
suppressScrollX: '@',
suppressScrollY: '@',
updateOnInit: '@',
useBothWheelAxes: '@',
useKeyboard: '@',
wheelPropagation: '@',
wheelSpeed: '@',
},
link: function postLink(scope, element) {
var init;
var updateOnInitTimer;
init = function() {
element.perfectScrollbar({
includePadding: scope.includePadding || false,
maxScrollbarLength: scope.maxScrollbarLength || null,
minScrollbarLength: scope.minScrollbarLength || null,
scrollXMarginOffset: scope.scrollXMarginOffset || 0,
scrollYMarginOffset: scope.scrollYMarginOffset || 0,
suppressScrollX: scope.suppressScrollX || false,
suppressScrollY: scope.suppressScrollY || false,
useBothWheelAxes: scope.useBothWheelAxes || false,
useKeyboard: scope.useKeyboard || true,
wheelPropagation: scope.wheelPropagation || false,
wheelSpeed: scope.wheelSpeed || 1
});
if ( scope.updateOnInit ) {
updateOnInitTimer = $timeout(function() {
element.perfectScrollbar('update');
});
}
};
scope.$on('$destroy', function() {
$timeout.cancel(updateOnInitTimer);
});
return init();
}
};
});