I have a directive as shown below:
.directive('scrollPosition', function($window) { return { scope: { scroll: '=scrollPosition' }, link: function(scope, element, attrs) { var windowEl = angular.element($window); var scrollhandler = function() { console.log("scrolling") } var starthandler = function() { console.log("scrolling start") } var stophandler = function() { console.log("scrolling end") } windowEl.on('scroll', scope.$apply.bind(scope, scrollhandler)); windowEl.on('scrollstart', scope.$apply.bind(scope, starthandler)); windowEl.on('scrollstop', scope.$apply.bind(scope, stophandler)); } }; });
With HTML:
<div id="imageHolder" style="opacity: {{scroll}}" scroll-position="scroll">
The only event that fires is the scroll event. I need two other events, not this, since I work on mobile and scrollable events that do not fire until scrolling stops on a mobile device (see here http://andyshora.com/mobile-scroll-event-problems .html )
I need to do something ordinary at the beginning and at the end.
Any idea what I'm doing wrong?
source share