Reputation: 602
I want to remove click effect of an ion-item.I used --background-activated and --ripple-color but nothing happend.
.no-click{
--background-activated: transparent;
--ripple-color: transparent;
}
<ion-item class="no-click">
<ion-avatar slot="start">
<img [src]="img">
</ion-avatar>
<ion-label>{{name}}</ion-label>
</ion-item>
How can i remove click effect of an ion-item?
Upvotes: 2
Views: 6629
Reputation: 63
This actually Works!
--ripple-color: transparent;
--background-activated: transparent;
--background-activated-opacity:transparent;
--background-focused: transparent;
--background-focused-opacity:transparent;
--background-hover : transparent;
--background-hover-opacity :transparent;
Upvotes: 5
Reputation: 3003
I would apply no-ripple class to ion-item and add the below styling
.no-ripple {
--ripple-color: transparent;
--background-activated: transparent;
}
This will remove ripple effect but will keep the element clickable. For example, you can have ion-checkbox inside ion-item and pointer-events:none; will prevent from clicking on it which might not be the behaviour that you need.
Upvotes: 8
Reputation: 1264
Simply give pointer-events:none css to disable click.
.no-click {
pointer-events:none; //This makes it not clickable
}
<ion-item class="no-click">
<ion-avatar slot="start">
<img [src]="img">
</ion-avatar>
<ion-label>{{name}}</ion-label>
</ion-item>
Upvotes: 4