Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70762

How to set CSS class to storage on click?

$
0
0

@cybentizens wrote:

Hi

How I can set css class to storage on click and then how I’ll get it?

Let me explain it to you more:
When user will click on button “24” then a class “fontSize24” is added to the content and when user clicks on button “30” then class “fontSize30” is added to the content and “fontSize24” is removed. How do I can save it to storage?

Code is given below:

fonts.html

<ion-item>
      <button (click)="fontSizeOne()">24</button>
<button (click)="fontSizeTwo()">30</button>
    </ion-item>

fonts.ts

fontSizeOne(direction: string) {
    this.textEle.style.fontSize = direction;
    this.textEle.classList.add('fontSize24');
    this.textEle.classList.remove('fontSize30');
  }

fontSizeTwo(direction: string) {
    this.textEle.style.fontSize = direction;
    this.textEle.classList.remove('fontSize24');
    this.textEle.classList.add('fontSize30');
  }

Best Regards

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>