angular-nicescroll.js 824 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. (function () {
  2. 'use strict';
  3. angular
  4. .module('angular-nicescroll', [])
  5. .directive('ngNicescroll', ngNicescroll);
  6. ngNicescroll.$inject = ['$rootScope'];
  7. /* @ngInject */
  8. function ngNicescroll($rootScope) {
  9. // Usage:
  10. //
  11. // Creates:
  12. //
  13. var directive = {
  14. link: link
  15. };
  16. return directive;
  17. function link(scope, element, attrs, controller) {
  18. var niceOption = scope.$eval(attrs.niceOption)
  19. var niceScroll = $(element).niceScroll(niceOption);
  20. niceScroll.onscrollend = function (data) {
  21. if (data.end.y >= this.page.maxh) {
  22. if (attrs.niceScrollEnd) scope.$evalAsync(attrs.niceScrollEnd);
  23. }
  24. };
  25. }
  26. }
  27. })();