forked from openshift/origin-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaffix.js
29 lines (28 loc) · 774 Bytes
/
affix.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
'use strict';
/* jshint unused: false */
angular.module('openshiftConsole')
.directive('affix', function($window) {
return {
restrict: 'AE',
scope: {
offsetTop: '@',
offsetBottom: '@'
},
link: function($scope, $elem, $attrs, ctrl) {
// for debugging
// angular
// .element($window)
// .bind("scroll", function() {
// var pos = $elem.affix('checkPosition')[0];
// console.log('affix position', pos.offsetWidth, pos.offsetHeight, pos.offsetTop, pos.offsetBottom);
// //$scope.$apply();
// });
$elem.affix({
offset: {
top: $attrs.offsetTop,
bottom: $attrs.offsetBottom
}
});
}
};
});