@@ -6,7 +6,8 @@ IonicModule
6
6
'$ionicPlatform' ,
7
7
'$ionicBody' ,
8
8
'$ionicHistory' ,
9
- function ( $scope , $attrs , $ionicSideMenuDelegate , $ionicPlatform , $ionicBody , $ionicHistory ) {
9
+ '$ionicScrollDelegate' ,
10
+ function ( $scope , $attrs , $ionicSideMenuDelegate , $ionicPlatform , $ionicBody , $ionicHistory , $ionicScrollDelegate ) {
10
11
var self = this ;
11
12
var rightShowing , leftShowing , isDragging ;
12
13
var startX , lastX , offsetX , isAsideExposed ;
@@ -148,8 +149,20 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
148
149
// add the CSS class "menu-open" if the percentage does not
149
150
// equal 0, otherwise remove the class from the body element
150
151
$ionicBody . enableClass ( ( percentage !== 0 ) , 'menu-open' ) ;
152
+
153
+ freezeAllScrolls ( false ) ;
151
154
} ;
152
155
156
+ function freezeAllScrolls ( shouldFreeze ) {
157
+ if ( shouldFreeze && ! self . isScrollFreeze ) {
158
+ $ionicScrollDelegate . freezeAllScrolls ( shouldFreeze ) ;
159
+
160
+ } else if ( ! shouldFreeze && self . isScrollFreeze ) {
161
+ $ionicScrollDelegate . freezeAllScrolls ( false ) ;
162
+ }
163
+ self . isScrollFreeze = shouldFreeze ;
164
+ }
165
+
153
166
/**
154
167
* Open the menu the given pixel amount.
155
168
* @param {float } amount the pixel amount to open the menu. Positive value for left menu,
@@ -297,6 +310,8 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
297
310
298
311
// End a drag with the given event
299
312
self . _endDrag = function ( e ) {
313
+ freezeAllScrolls ( false ) ;
314
+
300
315
if ( isAsideExposed ) return ;
301
316
302
317
if ( isDragging ) {
@@ -334,6 +349,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
334
349
335
350
if ( isDragging ) {
336
351
self . openAmount ( offsetX + ( lastX - startX ) ) ;
352
+ freezeAllScrolls ( true ) ;
337
353
}
338
354
} ;
339
355
@@ -415,6 +431,9 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
415
431
self . content . element = null ;
416
432
self . content = null ;
417
433
}
434
+
435
+ // ensure scrolls are unfrozen
436
+ freezeAllScrolls ( false ) ;
418
437
} ) ;
419
438
420
439
self . initialize ( {
0 commit comments