I have a side menu always visible in my ionic aplication, the problem is I don't know how to change the #shadow-root css, I tried a few things but still don't work.
The problem is that when I make the menu smaller and empty space is left there. I want to remove that empty space, because when the screen is bigger the empty space is even bigger.
I searched in the debug console and this is the troublesome element:
This is my code:
HTML:
<ion-split-pane contentId="side-menu" class="menu-left" when="md">
<ion-menu side="start" menuId="side-menu" contentId="side-menu" mode="md" class="menu2">
<ion-header>
<ion-toolbar>
<ion-title>Start Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list lines="none" class="menu-content">
<ion-item (click)="navigateHome()">
<ion-icon name="home" slot="start"></ion-icon>
<ion-label>Inicio</ion-label>
</ion-item>
<ion-item (click)="navigateAnimes()">
<ion-icon name="library" slot="start"></ion-icon>
<ion-label>Animes</ion-label>
</ion-item>
<ion-item (click)="navigateMine()">
<ion-icon name="bookmarks" slot="start"></ion-icon>
<ion-label>Mi lista</ion-label>
</ion-item>
<ion-item (click)="navigateSettings()">
<ion-icon name="options" slot="start"></ion-icon>
<ion-label>Ajustes</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
<ion-router-outlet id="side-menu"></ion-router-outlet>
</ion-split-pane>
CSS:
.menu-left{
--width: 200px;
}
.menu-content {
height: 100% !important;
width: 200px;
}
Can anyone tell me how to apply my css attributes to the inner-scroll scroll-y in the shadow class please?
#phantomiam123 I updated my css class and doesn't work:
My css class now is:
.menu-left{
--width: 200px;
}
.menu-content {
height: 100% !important;
width: 200px;
}
.inner-scroll .scroll-y {
width: 200px;
}
And in the debug console:
This seems to work for me for now:
.split-pane-visible > ion-menu {
max-width: 200px!important;
}
Related
Following code works fine in mobile view but source code does not work in web view. screenshot is attaced with question. split pane is not working as per required. same is happening with every component. I have tried many things like host: style{width:70%} but nothing works. Basically it should acquire remaining space of page.
<ion-split-pane class="ion-menu" contentId="mis-menu-content" when="xl">
<ion-menu type="overlay" contentId="mis-menu-content" class="menu-gradient">
<ion-content>
<div *ngFor="let p of appPages">
<ion-list>
<ion-menu-toggle auto-hide="false" *ngIf="p.url">
<ion-item
[routerDirection]="'root'"
[routerLink]="[p.url]"
routerLinkActive="active"
>
<ion-img slot="start" class="imgset" [src]="p.icon"></ion-img>
<ion-label class="menu-font"> {{p.title}} </ion-label>
</ion-item>
</ion-menu-toggle>
<ion-item
button
*ngIf="p.children?.length>0"
(click)="p.open = !p.open"
[class.active-parent]="p.open"
detail="false"
>
<ion-img slot="start" class="imgset" [src]="p.icon"></ion-img>
<ion-icon
class="imgset"
slot="end"
name="chevron-forward-outline"
*ngIf="!p.open"
></ion-icon>
<ion-icon
class="imgset"
slot="end"
name="chevron-down-outline"
*ngIf="p.open"
></ion-icon>
<ion-label class="menu-font">{{p.title}}</ion-label>
</ion-item>
<ion-list class="item-md-list" *ngIf="p.open">
<ion-menu-toggle auto-hide="false" *ngFor="let sub of p.children">
<ion-item
[routerDirection]="'root'"
[routerLink]="[sub.url]"
routerLinkActive="active"
>
<ion-img
slot="start"
class="imgset-sub"
[src]="sub.icon"
></ion-img>
<ion-label class="menu-font-sub"> {{sub.title}} </ion-label>
</ion-item>
</ion-menu-toggle>
</ion-list>
</ion-list>
</div>
</ion-content>
</ion-menu>
<ion-router-outlet id="mis-menu-content" main>
<link href="roboto.css" type="text/html" />
<ion-row>
<ion-col size-lg="12" size-md="12" size-sm="12" size="12">
<ion-title class="welcomelogo"
><img src="../../../assets/img/pil logo.png"
/></ion-title>
<ion-title class="welcometxt">
Welcome <br /><ion-title class="welcometxt1">To</ion-title
><br /><ion-title class="welcometxt2">Operations Portal</ion-title>
</ion-title>
</ion-col>
</ion-row>
</ion-router-outlet>
</ion-split-pane>
}
.split-pane {
position: absolute;
/* top: $SPLIT_TOP; */
}
ion-menu[type="overlay"] {
z-index: 80;
position: fixed;
}
ion-menu[type="reveal"] {
z-index: 80;
}
.menu-item{
background:none;
color:white;
font-weight:300;
border:0px;
.item-content{
background:none;
&.activated{
/* background: $MENU_TRANSPARENCY; */
}
}
&.active-page-highlight{
.item-content{
/* background: $MENU_TRANSPARENCY; */
}
}
}
I need to remove hamburger default icon menu on ionic menu. I've added custom menu and I need to remove default icon.
So my code:
<ion-menu side="start">
<ion-header>
<ion-toolbar>
<ion-title>Menu</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item>
<ion-icon name="home" slot="start"></ion-icon>
<ion-label>Home</ion-label>
</ion-item>
<ion-item>
<ion-icon name="person" slot="start"></ion-icon>
<ion-label>Profile</ion-label>
</ion-item>
<ion-item>
<ion-icon name="chatbubbles" slot="start"></ion-icon>
<ion-label>Messages</ion-label>
</ion-item>
<ion-item>
<ion-icon name="settings" slot="start"></ion-icon>
<ion-label>Settings</ion-label>
</ion-item>
</ion-list>
</ion-content>
</ion-menu>
My layout menu:
Html button code:
<ion-header _ngcontent-yjt-c1="" role="banner" class="ios header-ios hydrated">
<ion-toolbar _ngcontent-yjt-c1="" class="ios hydrated">
<ion-buttons _ngcontent-yjt-c1="" slot="start" class="buttons-first-slot sc-ion-buttons-ios-h sc-ion-buttons-ios-s ios hydrated">
<ion-menu-button _ngcontent-yjt-c1="" class="hydrated ios button ion-activatable ion-focusable"></ion-menu-button>
</ion-buttons>
<ion-title _ngcontent-yjt-c1="" class="ios title-ios hydrated"></ion-title>
</ion-toolbar>
</ion-header>
I need to remove default icon inside circle. How to do to remove?
Can you please try the following css rules?
Can you please check if they don't work if they get added to the css of the page you are viewing?
ion-menu-button {
display: none !important;
}
or
ion-buttons {
display: none !important;
}
or
.button.ion-activatable.ion-focusable {
display: none !important;
}
Add the below styles in your app.scss file to hide the default menu button
.bar-button-menutoggle {
display: none !important;
}
Greeting! As per title state, it seems like IONIC 3 Keyboard is not working fine on IOS. The keyboard is overlapping if switching to Emoji keyboard.
Like previous version of IONIC 1, there have directive 'keyboard-attach'. But starting IONIC 2, the directive is gone already and this keyboard issue came.
Anyone have solution for this? Below is my HTML code:
<ion-footer style="background-color: #f1f1f1; padding-bottom: 0px;">
<ion-toolbar>
<ion-row class="message_row">
<ion-col col-10>
<ion-item no-lines>
<input type="text" placeholder="Don't be shy, say something..." class="chatInput">
</ion-item>
</ion-col>
<ion-col col-2>
<button color="primary" (click)="sendMessage()" ion-button icon-only clear>
<ion-icon color="tom" name="md-send"></ion-icon>
</button>
</ion-col>
</ion-row>
</ion-toolbar>
</ion-footer>
SCSS code as below:
.chatInput {
width: 100%;
padding: 3px;
margin-left: auto;
margin-right: auto;
background-color: #fff;
border:0px;
font-size: 14px;
}
And here is the screen shot:
Thanks
In ionic how can i put a button at some percentage from the bottom ion-content?
I've tried
<ion-view>
<ion-content>
<div class="button-bottom">
<button class="button button-block button-energized">Button</button>
</div>
</ion-content>
</ion-view>
css:
.button-bottom{
position: absolute;
bottom: 30%;
}
but the button now not take the full width.
Try giving your container an explicit width:
.button-bottom{
position: absolute;
bottom: 30%;
width: 100%;
}
Add "full" variable in your button
Ex:- button class="button button-block button-energized" full >Button</button>
For more reference see Ionic Documentation on UI Components in the link below.
Ionic Full Button
Just move the button to outside of the ion-content.
Example:
Ionic 3:
<ion-view>
<ion-content>
</ion-content>
<div class="button-bottom">
<button class="button button-block button-energized">Button</button>
</div>
</ion-view>
Ionic 4:
<ion-header>
<ion-toolbar>
<ion-title>Example</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
<p> your content </p>
</ion-content>
<ion-row>
<ion-col>
<ion-button>
Button Bottom (Not fixed on scroll)
</ion-button>
</ion-col>
</ion-row>
I'm new to ionic and I've been struggling to add a logo to the sidebar menu which will shrink / expand when you switch from portrait to landscape. See example below,
Why I want to shrink the logo is so that all the items can be shown together and the user doesn't have to scroll. This would apply to smaller screens as well (If all the items can't be shown in one screen the logo should reduce it's size to make room.)
This is my template,
<ion-side-menu side="left">
<ion-header-bar class="logo">
< img src="/images/logo.png" />
</ion-header-bar>
<ion-content>
<ion-list>
<ion-item menu-close ui-sref="x.1" class="item-icon-left"> 1 </ion-item>
<ion-item menu-close ui-sref="x.2" class="item-icon-left"> 2 </ion-item>
<ion-item menu-close ui-sref="x.3" class="item-icon-left"> 3 </ion-item>
</ion-list>
</ion-content>
</ion-side-menu>
and the CSS
.logo img {
max-height: 56px;
max-width: 120px;
margin: 0 auto;
margin-top: 20px;
display: block;
}