能否请您告诉我如何停止向左和向右滑动事件。实际上,我做了一个简单的幻灯片菜单演示,实际上幻灯片菜单显示在演示中。它在向右滑动时打开。我不想这样做。.当用户使用向左或向右滑动事件时,我不想打开幻灯片菜单。仅当用户使用左上角的图标(菜单图标)时也可以打开使用相同的图标隐藏。换句话说,用户使用左上方的图标切换幻灯片菜单。当用户向左和向右滑动时,不想显示幻灯片菜单。
这是我的代码
http://run.plnkr.co/taSxxNDMgBcJFP5A/#/app/playlists
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="http://code.ionicframework.com/1.0.0/css/ionic.min.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
<script src="controller.js"></script>
<script src="app.js"></script>
</head>
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>
</html>
最佳答案
.controller('AppCtrl', function($scope, $ionicModal, $timeout,$ionicSideMenuDelegate) {
$scope.$on('$ionicView.enter', function(){
$ionicSideMenuDelegate.canDragContent(false);
});
$scope.$on('$ionicView.leave', function(){
$ionicSideMenuDelegate.canDragContent(true);
});
......
});
包含
$ionicSideMenuDelegate
并监听事件:$ionicView.enter
和$ionicView.leave