Custom menu styling

Custom menu styling

by Gratiela Dascalu -
Number of replies: 0

I'm trying to style the top custom menu to add a 'active' class on the clicked item and style it after with css. I did that with jquery, the code below:

{{#js}}  

         require(['jquery'], function($) { 

                $('.navbar-toolbar').on( 'click', '.nav-item', function() {

                    $('.nav-item').removeClass('active');

                     $( this ).addClass('active');

                });         

});

    {{/js}}

My problem is, the class is only added the moment before reloading the page and after is gone. Can you give me some advice on how to do this? Maybe with PHP?



Average of ratings: -