mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Merge branch 'master' of github.com:driftyco/ionic
This commit is contained in:
2
js/angular/controller/scrollController.js
vendored
2
js/angular/controller/scrollController.js
vendored
@@ -162,7 +162,7 @@ function($scope,
|
||||
|
||||
self.freezeAllScrolls = function(shouldFreeze) {
|
||||
for (var i = 0; i < $ionicScrollDelegate._instances.length; i++) {
|
||||
$ionicScrollDelegate._instances[x].freezeScroll(shouldFreeze);
|
||||
$ionicScrollDelegate._instances[i].freezeScroll(shouldFreeze);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
21
js/angular/controller/sideMenuController.js
vendored
21
js/angular/controller/sideMenuController.js
vendored
@@ -6,7 +6,8 @@ IonicModule
|
||||
'$ionicPlatform',
|
||||
'$ionicBody',
|
||||
'$ionicHistory',
|
||||
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory) {
|
||||
'$ionicScrollDelegate',
|
||||
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate) {
|
||||
var self = this;
|
||||
var rightShowing, leftShowing, isDragging;
|
||||
var startX, lastX, offsetX, isAsideExposed;
|
||||
@@ -148,8 +149,20 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
|
||||
// add the CSS class "menu-open" if the percentage does not
|
||||
// equal 0, otherwise remove the class from the body element
|
||||
$ionicBody.enableClass((percentage !== 0), 'menu-open');
|
||||
|
||||
freezeAllScrolls(false);
|
||||
};
|
||||
|
||||
function freezeAllScrolls(shouldFreeze) {
|
||||
if (shouldFreeze && !self.isScrollFreeze) {
|
||||
$ionicScrollDelegate.freezeAllScrolls(shouldFreeze);
|
||||
|
||||
} else if (!shouldFreeze && self.isScrollFreeze) {
|
||||
$ionicScrollDelegate.freezeAllScrolls(false);
|
||||
}
|
||||
self.isScrollFreeze = shouldFreeze;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the menu the given pixel amount.
|
||||
* @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
|
||||
|
||||
// End a drag with the given event
|
||||
self._endDrag = function(e) {
|
||||
freezeAllScrolls(false);
|
||||
|
||||
if (isAsideExposed) return;
|
||||
|
||||
if (isDragging) {
|
||||
@@ -334,6 +349,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
|
||||
|
||||
if (isDragging) {
|
||||
self.openAmount(offsetX + (lastX - startX));
|
||||
freezeAllScrolls(true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -415,6 +431,9 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
|
||||
self.content.element = null;
|
||||
self.content = null;
|
||||
}
|
||||
|
||||
// ensure scrolls are unfrozen
|
||||
freezeAllScrolls(false);
|
||||
});
|
||||
|
||||
self.initialize({
|
||||
|
||||
Reference in New Issue
Block a user