[英]How do you disable the drag function on an ionic side menu?
How do you disable the drag function on an ionic side menu? 如何在离子侧菜单上禁用拖动功能? I am pretty new to this and need help.
我是新手,需要帮助。 When I swipe right on the main page... it opens up a menu and I don't want this to happen.
当我在主页面上向右滑动时......它会打开一个菜单,我不希望这种情况发生。 Here is my current code:
这是我目前的代码:
<!-- Side menu -->
<ion-side-menu side="left" drag-content="false">
<ion-header-bar class="bar-dark">
<h1 class="title">Cards</h1>
</ion-header-bar>
<ion-content scroll="true">
</ion-side-menus>
Javascript: 使用Javascript:
$scope.$root.canDrag = false;
Drag-content attribute must be written over tag. Drag-content属性必须写在标签上。
For eg : 例如:
<ion-side-menu side="left">
<ion-pane ion-side-menu-content drag-content="false">
<ion-header-bar class="bar-dark">
<h1 class="title">Cards</h1>
</ion-header-bar>
<ion-content scroll="true">
</ion-content>
</ion-pane>
</ion-side-menus>
This will do the job. 这将完成这项工作。 !!
!
Edit :
编辑:
To Create a Menu Close Button, add the attribute menu-toggle="menu_side" to the button. 要创建菜单关闭按钮,请将属性menu-toggle =“menu_side”添加到按钮。
Eg 例如
<button menu-toggle="right" class="button transparent button-icon icon ion-navicon"></button>
You can disable drag side menu, for example on login page where you don't want side menu to be visible. 您可以禁用拖动侧面菜单,例如在您不希望侧面菜单可见的登录页面上。
(function () {
'use strict';
angular
.module('myApp')
.controller('LoginCtrl', [
'$scope',
'$log',
'$ionicSideMenuDelegate',
LoginFunction]);
function LoginFunction($scope, $log, $ionicSideMenuDelegate) {
var vm = this;
$log.debug('its working');
$ionicSideMenuDelegate.canDragContent(false)
}
}());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.