AlbertSchw
AlbertSchw

Reputation: 1

Toggle ionic side menu via javascript

i just started developing mobile application with ionic and angular js. Now i added a side menu into my application.

I would like to toggle this one via javascript because i'm using angular and ionic with jquery-mobile for my page transitions etc. I would like to have a smooth transition after the page changed. menu-close as an attribute doesn't help me because i have to add the menu twice or more because of the single sites.

I didn't found any examples for a single page application, based on angular/ionic and jquery mobile. I only would like to use the great side menu from ionic (or is it angular)? Is it possible to use this without angular? If yes, how?

function toggleIt(){
    close.sideMenu;
}

something like that should trigger the function that looks like you've clicked on the toggle btn.

I hope someone can help me!

Upvotes: 0

Views: 616

Answers (1)

Raymond Camden
Raymond Camden

Reputation: 10857

Ionic side menus do support opening/closing them via an API call. Look at the menu-toggle directive (http://ionicframework.com/docs/api/directive/menuToggle/) as an example. Here is a sample:

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

I forgot to add, you can also do $ionicSideMenuDelegate.toggleLeft(); (and I assume toggleRight) to open/close side menus.

Upvotes: 1

Related Questions