Menu item always open

Asked

Viewed 36 times

0

I have a side menu that when the user clicks changes the color of a selected item in the menu through a javascript code, however when an update occurs on the screen the class is removed. Would anyone have any tips on how to leave with the selected color after screen update?

I wanted you to have the same behavior https://blackrockdigital.github.io/startbootstrap-sb-admin-2/pages/index.html

   var selector2 = '.menu-section-list li';

    $(selector2).on('click', function () {
        console.log("s");
         $(selector2).removeClass('active');
        $(this).addClass('active');
    });

Menu

  • gives a read here: http://stackoverflow.com/questions/30060155/saving-website-styles-in-cookies

1 answer

0


Note that in the sbadmin each menu option loads a different page that is displayed on url, with this it is easy to check in which screen state is just checking the url, which can be obtained with window.location.href.

Having said that it is worth saying that sbadmin uses the metisMenu.js and you can study how this is implemented or simply use it as well.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.