Skip to content

Commit

Permalink
fix(sideMenu): Close side-menu if open and content tapped, closes #648
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Bradley committed Mar 1, 2014
1 parent 159e0b9 commit 0c5c675
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions js/ext/angular/src/directive/ionicSideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
var isDragging = false;

// Listen for taps on the content to close the menu
/*
ionic.on('tap', function(e) {
sideMenuCtrl.close();
}, $element[0]);
*/
function contentTap(e) {
if(sideMenuCtrl.getOpenAmount() !== 0) {
sideMenuCtrl.close();
e.gesture.srcEvent.preventDefault();
}
}
ionic.on('tap', contentTap, $element[0]);

var dragFn = function(e) {
if($scope.dragContent) {
Expand Down Expand Up @@ -139,6 +141,7 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
$ionicGesture.off(dragUpGesture, 'dragup', dragFn);
$ionicGesture.off(dragDownGesture, 'dragdown', dragFn);
$ionicGesture.off(releaseGesture, 'release', dragReleaseFn);
ionic.off('tap', contentTap, $element[0]);
});
};
}
Expand Down

0 comments on commit 0c5c675

Please sign in to comment.