Last active
August 29, 2015 14:07
-
-
Save dgieselaar/850df171752558f81200 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="scrollable" coen-scroll> | |
<ul class="actual-menu" data-ng-show="coenScroll.getScroll()>100"> | |
</ul> | |
</div> | |
<script type="text/javascript"> | |
angular.module('coen') | |
.directive('coenScroll', [ '$parse', function ( $parse ) { | |
return { | |
controller: [ '$scope', '$element', '$attrs', function ( $scope, $element, $attrs ) { | |
var ctrl = {}; | |
ctrl.getScroll = function ( ) { | |
var scrollPosition = 0; //compute | |
return scrollPosition; | |
}; | |
$element.bind('scroll', function ( ) { | |
if($attrs.coenScroll) { | |
$parse($attrs.coenScroll)($scope, { $scroll: ctrl.getScroll() }); | |
} | |
}); | |
return ctrl; | |
}], | |
controllerAs: 'coenScroll' | |
} | |
}]); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment