Font-Awesome 5
See original GitHub issueHi guys,
I’m using metismenu 2.7.1
in sb-admin2
template.
I’m having a lot of problems because i’m using font-awesome 5. Is it possible to update the Metis Menu with font-awesome 5? Would greatly appreciate it.
Thanks for your time!!
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Find the Perfect Icon for Your Project in Font Awesome 5
Search all the Version 5 icons and match your project with a look and feel that's just right. Better yet, try Font Awesome...
Read more >Find the Perfect Icon for Your Project in Font Awesome 5
Search all the Version 5 icons and match your project with a look and feel ...
Read more >Font Awesome
Font Awesome is the Internet's icon library and toolkit, used by millions of designers, developers, and content creators. Start for Free Get More...
Read more >Regular style in Version 5 | Font Awesome
Search all the Version 5 icons and match your project with a look and feel ...
Read more >Find Icons with the Perfect Look & Feel - Font Awesome
Five styles that are always in fashion and ready to bring that extra level of iconic flair to projects. Solid. Great for bold...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Someone much smarter than me can probably come up with a more elegant solution, but here’s something… I didn’t want to edit metisMenu directly and updating the CSS for sbadmin had no effect. I added this JS instead to handle the show and collapse events:
And this is probably more appropriate in the sbAdmin repo, but this was the only Google result; so, cheers.
The code above did not work for me because metisMenu uses its own events for showing and hiding the menu and was eating the bootstrap events, at least that is what I understood from my debug session. I ended up using the following code (tested with metisMenu 2.7.7 and FontAwesome 5.0.13 SVG). This should work with any level of menu.
$('#yourMenuSelectorId').metisMenu().on('show.metisMenu', function (e) { $(e.target).siblings('a').children('svg[data-icon=angle-left]').removeClass('fa-angle-left').addClass('fa-angle-down'); }).on('hide.metisMenu', function (e) { $(e.target).siblings('a').children('svg[data-icon=angle-down]').removeClass('fa-angle-down').addClass('fa-angle-left'); });