Reputation: 2129
How can I insert in the DOM a css class using aurelia.js?
If my <th>
has the class="aut-asc"
or class="aut-asc"
, I would like to add a extra class called: global
aut-asc is added when it is clicked, fine but the thing is I need the th who has this class has red background.
now the background it is just in the arrow.
.aut-desc:before{
content: $fa-var-sort;
background-color: red;
}
if not don't do anything.
<thead>
<tr>
<th class="aut-asc">
Sort
</th>
</tr>
</thead>
Upvotes: 2
Views: 969
Reputation: 10897
You can toggle adding and removing a css class from a variable using string interpolation:
<th class="aut-asc ${toggleVariable ? 'global' : ''}">
Upvotes: 3