How to disable side menu when sliding over a div?

Thank you very very much, you are great ! :smile:
I felt very happy when I saw CodePen example, but unfortunately it doesn’t work in my app :frowning:
I am sorry but I could not understand this sentence
What do you mean in it ??

“Swiped!” is printed every time I swipe the menu, but it doesn’t moved or swiped

English isn’t my native ^^!

I’m not sure what trouble you’re having. Here’s a GIF that shows “swiping” the nav-bar works on Page 2.

1 Like

Yup, I’ve seen it, but don’t know why it doesn’t working in my app !

Thanks again :slight_smile:

You’ll need to post your code in order for us to help. Right now, it’s ipossible to say what’s wrong your real sample.

1 Like

Thank you very much @Calendee
I’ve resolved the problem :slight_smile:
I added new controller in in index page and added it to the controller.js file
In this controller I added toggleLeft Function :slight_smile:

I was using the “$scope.$root.canDrag = true;” approach but then I found that this looks to be a cleaner way of handling it.

$ionicSideMenuDelegate.canDragContent(false);

Thought I would go ahead and share this as well.

I do this in my app.js so that other views are able to drag the side menu.

.run(function($rootScope, $ionicPlatform, $ionicSideMenuDelegate) {
  $rootScope.$on('$stateChangeSuccess', function () {
    // By default, we want to allow the side-menu to be dragged. 
    // Some views may need to disable it so we want to enable it 
    // after a successful state change
    $ionicSideMenuDelegate.canDragContent(true);
  });
})

@Calendee I am having this same requirement. What’s you take rather than adding $root.canDrag we can have check in .run()

if(toState.name == "sidebar.productdetail") {
    $ionicSideMenuDelegate.canDragContent(false);
} else {
    $ionicSideMenuDelegate.canDragContent(true);
}

This we we dont have to set drag in each controller ! What’s your take on this method ?

If it works, go for it. Perhaps you’d be better putting it in a $stateChangeStart event listener in .run.

Mr @Calendee I’m very sorry, but when I update ionic to nightly version everything in the app corrupted !!!
this error appears :
Error:
[$compile:multidir] Multiple directives [ionNavBar, navBarSwipe] asking
for new/isolated scope on:

and if you want … here I just change

<script src="//code.ionicframework.com/1.0.0-beta.12/js/ionic.bundle.js"></script>

to

<script src="//http://code.ionicframework.com/nightly/js/ionic.bundle.js"></script>

The nightlies have extensive breaking changes. You’re going to need to pick through them to grasp all of the differences.

See the list here : Please help test: Angular 1.3, improved transitions, cached views, etc

Also, note that the nightlies downloads have a changelog.html that explains things as well.

Yep, I know that, and I spent a lot of time yesterday to check error :fearful:
In this example … when I delete ‘navBarSwip’ directive it works… But not as I want …
because the error is: Multiple directives [ionNavBar, navBarSwipe]

In beta14, this is broken by the way. Just in case someone else is trying to get this to work with the latest release
$ionicSideMenuDelegate.canDragContent(false);

(Possible*) Fix here: https://github.com/driftyco/ionic/pull/2752

Thanks @gx14, too much time trying and failing. Please, it has to be merged

Thank you, is working to me!