diff --git a/js/angular/directive/slideBox.js b/js/angular/directive/slideBox.js index 10f302f06ac..4d02e793334 100644 --- a/js/angular/directive/slideBox.js +++ b/js/angular/directive/slideBox.js @@ -41,7 +41,8 @@ IonicModule '$compile', '$ionicSlideBoxDelegate', '$ionicHistory', -function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory) { + '$ionicScrollDelegate', +function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) { return { restrict: 'E', replace: true, @@ -81,9 +82,25 @@ function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory) { $scope.activeSlide = slideIndex; // Try to trigger a digest $timeout(function() {}); + }, + onDrag: function() { + freezeAllScrolls(true); + }, + onDragEnd: function() { + freezeAllScrolls(false); } }); + function freezeAllScrolls(shouldFreeze) { + if (shouldFreeze && !_this.isScrollFreeze) { + $ionicScrollDelegate.freezeAllScrolls(shouldFreeze); + + } else if (!shouldFreeze && _this.isScrollFreeze) { + $ionicScrollDelegate.freezeAllScrolls(false); + } + _this.isScrollFreeze = shouldFreeze; + } + slider.enableSlide($scope.$eval($attrs.disableScroll) !== true); $scope.$watch('activeSlide', function(nv) { diff --git a/js/views/scrollView.js b/js/views/scrollView.js index acc0ec2b9e9..2879a8e2bb4 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -692,7 +692,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ //update scroll view self.resize(); - }) + }); } self.isShrunkForKeyboard = true; diff --git a/js/views/sliderView.js b/js/views/sliderView.js index c7ce9fe8035..d04d2368b90 100644 --- a/js/views/sliderView.js +++ b/js/views/sliderView.js @@ -361,6 +361,7 @@ ionic.views.Slider = ionic.views.View.inherit({ translate(index+1, delta.x + slidePos[index+1], 0); } + options.onDrag && options.onDrag(); } }, @@ -451,6 +452,7 @@ ionic.views.Slider = ionic.views.View.inherit({ document.removeEventListener('mouseup', events, false); } + options.onDragEnd && options.onDragEnd(); }, transitionEnd: function(event) {