feat($ionicScrollDelegate): add scrollBy(left,top,animate) to delegate

Closes #987
This commit is contained in:
flmu
2014-03-31 11:34:08 +02:00
committed by Andy Joslin
parent 9a49129aa0
commit f847c20847
3 changed files with 20 additions and 1 deletions

View File

@@ -86,6 +86,14 @@ angular.module('ionic.ui.scroll')
* @param {boolean=} shouldAnimate Whether the scroll should animate.
*/
'scrollTo',
/**
* @ngdoc method
* @name $ionicScrollDelegate#scrollBy
* @param {number} left The x-offset to scroll by.
* @param {number} top The y-offset to scroll by.
* @param {boolean=} shouldAnimate Whether the scroll should animate.
*/
'scrollBy',
/**
* @ngdoc method
* @name $ionicScrollDelegate#anchorScroll
@@ -287,6 +295,12 @@ function($scope, scrollViewOptions, $timeout, $window, $$scrollValueCache, $loca
});
};
this.scrollBy = function(left, top, shouldAnimate) {
this.resize().then(function() {
scrollView.scrollBy(left, top, !!shouldAnimate);
});
};
this.anchorScroll = function(shouldAnimate) {
this.resize().then(function() {
var hash = $location.hash();