U

How to dynamically use FontAwesome icons in CSS with XenForo templates?

  • Thread starter Thread starter unutKan
  • Start date Start date

Visitor Greeting

Welcome to NullWarehouse.com... We are currently seeking Mod's and Contributors. If you wish to apply for a Mod position then please click on Members dropdown arrow, then click on Staff App and fill it out completely and submit it. If you want to be a Contributor then start contributing and we will have our eye on you and take notice, something great could come of it.

  • We have redone the forum. If you notice any issues or errors please open a Support Ticket under the Members dropdown and let us know.
U

unutKan

Guest

Hi all,

I'm developing a XenForo 2.3 add-on and need to show icons dynamically based on template variables.

I have a variable like {$item.iconClass} that contains icon classes such as "fal fa-award".

In HTML, this works fine:

<xf:fa icon="{$item.iconClass}" />

But I want to use these icons in CSS pseudo-elements with the .m-faContent() LESS mixin, like this:

Less:
Code:
&:before {
    .m-faContent({$item.iconClass});
}

This doesn't work because .m-faContent() expects a...

Read more

Continue reading...
 
Similar content Most view View more
Back
Top Bottom