question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi 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:open
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
messyhair66commented, Mar 7, 2018

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:

            $('ul.nav-second-level').each(function() {
                $(this).on('show.bs.collapse', function() {
                    $(this).siblings('a').children('svg[data-icon=angle-left]').each(function(index, value) {
                        $(value).removeClass('fa-angle-left').addClass('fa-angle-down');
                    });
                }).on('hide.bs.collapse', function() {
                    $(this).siblings('a').children('svg[data-icon=angle-down]').each(function(index, value) {
                        $(value).removeClass('fa-angle-down').addClass('fa-angle-left');
                    });
                });
            });

And this is probably more appropriate in the sbAdmin repo, but this was the only Google result; so, cheers.

0reactions
AlexM1dn1ghtcommented, Jun 20, 2018

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'); });

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found