We are working on an application, which uses ngCordova and would like to implement a side menu. The side menu has been implemented, as shown below.
After adding the subheader, the menu looks like this:
This is our code for the side menu:
<ion-view title="Home" ng-app="app.controllers" >
<ion-header-bar class="bar bar-subheader bar-positive">
<h1 class="title">Subheader</h1>
</ion-header-bar>
<ion-side-menus ng-controller="homeCtrl">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left" >
<ion-header-bar class="bar-stable bar-dark">
<h1 class="title">Category</h1>
</ion-header-bar>
<ion-list class="dark">
<ion-item nav-clear menu-close href="" class="item item-icon-left" >
<i class="icon ion-ios7-ionic-outline ion-ios-home-outline"></i><span style="color:#666">Home</span>
</ion-item>
<ion-item nav-clear menu-close href="#/tab/home" class="item item-icon-left" >
<i class="icon ion-ios7-help ion-ios-home-outline"></i><span style="color:#666">Home</span>
</ion-item>
<ion-item nav-clear menu-close href="" class="item item-icon-left" >
<i class="icon ion-ios7-help ion-ios-paw-outline"></i><span style="color:#666">Dogs</span>
</ion-item>
<ion-item nav-clear menu-close href="" class="item item-icon-left" >
<i class="icon ion-ios7-help ion-ios-cog-outline"></i><span style="color:#666">Profile Settings</span>
</ion-item>
<ion-item nav-clear menu-close href="" class="item item-icon-left" >
<i class="icon ion-ios7-help ion-ios-checkmark-outline"></i><span style="color:#666">History Orders</span>
</ion-item>
</ion-list>
</ion-side-menu>
</ion-side-menus>
</ion-view>
We would like the subheader to move left and right like the menu button, but it is not doing that right now. How can I solve this issue?
You are defining the subheader outside of the element for the side menu, which is why it is not acting the way you would like it to. You can solve this by moving the following code:
<ion-header-bar class="bar bar-subheader bar-positive">
<h1 class="title">Subheader</h1>
</ion-header-bar>
To the<ion-side-menu side="left>:
<ion-side-menu side="left">
<ion-header-bar class="bar-stable bar-dark">
<h1 class="title">Category</h1>
</ion-header-bar>
<ion-header-bar class="bar bar-subheader bar-positive">
<h1 class="title">Subheader</h1>
</ion-header-bar>
Related
I am trying to add pages with links in navigation bar(to be in middle). On the right I want to have nav button which on click open the side bar on the right. For now I just put the nav button but I cant figure how to put links in center of navigation bar. Code example:
<ion-side-menus>
<ion-side-menu-content>
<ion-nav-bar class="bar-stable">
<ion-nav-back-button ng-click="myGoBack()">
</ion-nav-back-button>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear ion-navicon" menu-toggle="right">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent">
</ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="right">
<ion-content>
<ion-list>
<ion-item menu-close ng-click="">
Traveler
</ion-item>
<ion-item menu-close href="">
Pinko
</ion-item>
<ion-item menu-close href="">
Club
</ion-item>
<ion-item menu-close ng-click="">
My Agency
</ion-item>
<ion-item menu-close href="">
My Karma
</ion-item>
<ion-item menu-close href="">
Notification
</ion-item>
<ion-item menu-close href="">
Profile
</ion-item>
<ion-item menu-close href="">
Settings
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
Aslo here is an image so you can see what I need:
I don't know how you are handling the transition to different $states, but you can try to insert the links inside the <ion-nav-title> tag in the following way:
<ion-nav-title align='center'>
<span>Link 1</span>
<span>Link 2</span>
<span>Link 3</span>
</ion-nav-title>
Then if you want to move the title on the left side like in the image you have attached, you can use $ionicNavBarDelegate inside your controller with $ionicNavBarDelegate.align('left').
Finally if you want to modify the spacing or the color of the links, do it via css like I did in this fiddle. I hope that my answer helps you!
I have problem removing an animation to my ionic app. The main problem is I dont know how to disable side bar opening on screen swipe. I want my side bar just open on click the nav-icon not to open on page swipe.
My nav code is here:
<ion-side-menus>
<ion-side-menu-content>
<ion-nav-bar class="bar-traveler">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-title class="heder-tabs">
<span><a >Travel</a></span>
<span><a >Location</a></span>
<span><a >Networking</a></span>
</ion-nav-title>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear ion-navicon" menu-toggle="right">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view class="has-header"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="right">
<ion-content>
<ion-list>
<ion-item menu-close ng-click="">
Traveler
</ion-item>
<ion-item class="side-navigation-pinko" menu-close href="">
<div class="pinko-nav">
<div class="pinko-sidenav-logo">
<img src="img/pro4travel-logo.png">
</div>
<div class="first-three-nav-choice">Pinko</div>
</div>
</ion-item>
<ion-item menu-close href="">
Club
</ion-item>
<ion-item menu-close ng-click="">
My Agency
</ion-item>
<ion-item menu-close href="">
My Karma
</ion-item>
<ion-item menu-close href="">
Notification
</ion-item>
<ion-item menu-close href="">
Profile
</ion-item>
<ion-item menu-close href="">
Settings
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
Find solution myself. I have just added to ion-side-menu-content an drag-content like this:
<ion-side-menu-content drag-content="false">
I am new to angular and ionic and would was trying to make an app
<ion-side-menus >
<ion-side-menu-content>
<ion-nav-bar class="bar-assertive nav-title-slide-ios7">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-bar>
<ion-nav-view></ion-nav-view>
</ion-side-menu-content>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-energized ">
<h1 class="title">My Test</h1>
</ion-header-bar>
<ion-content class="has-header">
<ion-list>
<ion-item href="#/" class="item-icon-left" menu-close><i class="icon ion-home"></i> Home</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
My side menu hamburger icon doesnt show up and is always hidden behind the navbar.If i remove the navbar then the icon is visible! how to resolve this please help!
Working code.. Use Ion header .You was using 2 times
<ion-side-menus >
<ion-side-menu-content>
<ion-header-bar class="bar-positive">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
<h1 class="title" >Slider </h1>
</ion-header-bar>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-energized ">
<h1 class="title">My Test</h1>
</ion-header-bar>
<ion-content class="has-header">
<ion-list>
<ion-item href="#/" class="item-icon-left" menu-close><i class="icon ion-home"></i> Home</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
I have an ionic side menu. I want to add background-image. Side-Menu codes are the following.
<ion-side-menus enable-menu-with-back-views="true">
<ion-side-menu-content>
<ion-nav-bar class="bar-dark">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left"></button>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<button class="button button-icon button-clear ion-log-out" ng-click="logout()"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent" style="background-color:red;">
</ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-dark">
<h1 class="title">Menu</h1>
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>
Dashboard
</ion-item>
<ion-item menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>
Statistics
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>
How to add background image to ionic side menu?
You can define your custom CSS as follows:
.my-container {
background-image: url("http://www.planwallpaper.com/static/images/colorful-triangles-background_yB0qTG6.jpg");
background-repeat: repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
height: 100%;
position: absolute;
}
.transp .item-content {
background-color: transparent !important;
color: #fff;
}
and apply those classes to proper HTML items:
<ion-side-menu side="left">
<ion-header-bar class="bar-dark">
<h1 class="title">Menu</h1>
</ion-header-bar>
<ion-content class="my-container">
<ion-list>
<ion-item class="transp" menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>Dashboard
</ion-item>
<ion-item class="transp" menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>Statistics
</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
Here is a codepen: http://codepen.io/beaver71/pen/WrqgNm
Well I don't know exactly if this would be the right way but you can try this in your <ion-content> </ion-content>
<ion-content style="background: url('img/a.jpg'); background-size: cover;">
<ion-list>
<ion-item menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>
Dashboard
</ion-item>
<ion-item menu-close href="#/app/dashboard">
<i class="icon icon-dashboard" style="font-size:20px;margin-right:10px;"></i>
Statistics
</ion-item>
</ion-list>
</ion-content>
It might help your case.
i added ion-nav-back-button to my side menu in ion-nav-bar but the problem that the nav back button hadn't been displayed, i don't know why i tried many attributes but it is still hidden,the following code for my menu layout with side menu code
<ion-side-menu-content>
<ion-nav-bar class="bar-balanced" align-title="center">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button menu-toggle="left" class="button button-icon icon ion-navicon"></button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="mainContent" ></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<header id="header" class="bar bar-header bar-balanced">
<h1 class="Side Menu"></h1>
</header>
<ion-content class="has-header" has-subheader="false">
<ion-list>
<ion-item nav-clear menu-close ui-sref="">Home</ion-item>
<ion-item nav-clear menu-close ui-sref="app.account">Account</ion-item>
<ion-item nav-clear menu-close ui-sref="app.help">Help</ion-item>
<ion-item nav-clear menu-close ui-sref="">Sign Out</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-stable">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-stable">
<h1 class="title">Menu</h1>
</ion-header-bar>
<ion-content class="menubox">
<ion-list>
<ion-item menu-close href="#/app/home">Home</ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
</ion-side-menus>