ngx-responsive icon indicating copy to clipboard operation
ngx-responsive copied to clipboard

Add a css class based on device

Open hassanasad opened this issue 7 years ago • 2 comments

Hi, Is there a way to add a class such as 'iphone' or 'ipad' to an element using code logic?

For instance something like:

[class.iphone]="device.iphone == true"

hassanasad avatar Mar 02 '17 11:03 hassanasad

Hi, I'm interested in the same question. Currently Im doing a horrorous hack

<component-nav *isMobile [ngClass]="{'fixed': isFixed === true }"></component-nav>
<component-nav *isDesktop></component-nav>

I calculated isFixed based in the scroll, in this view I have other elements that use the same variable isFixed.

hbruno avatar Jun 30 '17 18:06 hbruno

Hello,

I would also need this with responsive-window feature:

<div [responsive-window]="'parent'">
     <p [class.max-width-sm]="{ sizes:{  window: 'parent', min:900, max:1400} }"></p>
</div>

or maybe :

<div [responsive-window]="'parent'">
     <p [responsive-class]="{ 'max-width-sm': { sizes:{  window: 'parent', min:900, max:1400} } }"></p>
</div>

no-more avatar Dec 03 '18 13:12 no-more