Reverse Scroll Direction With Angularjs
I'm building an Ionic / Angular app and I'm in a situation that I would like to reverse the scroll direction on scroll input. So normally when you scroll down for example the area
Solution 1:
Yes, it is possible. Look at this jsFiddle.
HTML:
<divng-app="scrollApp"><scrollbox><!-- my directive -->
Content to be scrolled
</scrollbox></div>
JavaScript:
var app = angular.module('scrollApp', []);
app.directive('scrollbox', function($window) {
angular.element($window).bind('mousewheel', function(event) {
event.preventDefault(); // cancel the default scrollvar currentPosition = $window.pageYOffset;
var delta = event.wheelDelta;
window.scrollTo(0, currentPosition + delta);
});
return {};
});
Post a Comment for "Reverse Scroll Direction With Angularjs"