How do you disable the drag function on an ionic side menu?

Garrett picture Garrett · Nov 4, 2014 · Viewed 10.6k times · Source

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:

$scope.$root.canDrag = false; 

Answer

Manish Kr. Shukla picture Manish Kr. Shukla · Nov 4, 2014

Drag-content attribute must be written over tag.

For e.g :

<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.

E.g

<button menu-toggle="right" class="button transparent button-icon icon ion-navicon"></button>