2
So I’m trying to make those responsive headers that, when clicked, organize the column and change the "arrow" up or down. Currently I already have my Sorts working, but still missing this "responsiveness" of icones.
So my problem is:
I have the current icon: fa fa-fw fa-sort
=
I would like when an 'X' header is clicked, the icon changes to: fa fa-fw fa-sort-down
=
How do I change icons through clicks? Also, you can click the header:
<th id="teste" rowspan="2" style="text-align: center; vertical-align: middle">Cliente <i class="fa fa-fw fa-sort"></i></th>
And, when some other is clicked, this respective goes back to the original icon?
Take a look at this question [ https://answall.com/questions/105227/trocar-classe-com-javascript-ou-jquery ], it’s about changing the class of an element, maybe it serves you.
– Fabricio
But, what do you really want to do? You say in the title of the question Font-awesome icon responsive and in the text of the question but this "responsiveness" of the icons is still missing.. You want to change the icons with a click or you want when the screen has a certain resolution to change the icon?
– LeAndrade
Only an OBS, in the case of your last sentence of the question is not enough Go back to the previous icon, you would have to go back to the icon and go back to the table as well, if it would not make sense to just go back to the icon and not go back to the column ordering too...
– hugocsl
It has to be only with Javascript or you can use jQuery?
– hugocsl
Answer the questions: Fabricio: It served to have an idea, I’m already more targeted now. Thank you! Leandrade: With "responsiveness" I mean that the icon is interactive. When I click, I want it to change to "/" and "/", which will correspond with column ordering. Hugocsl: I got it, I figured I’d have to switch back. And to answer your question: it may be either way in truth (hahaha), in a first approximation I just want it to work even.
– David