Form Menu

Asked

Viewed 42 times

1

Tela do sistema

I would like the menu next to be selected according to the page. Home is selected because it has the class "active". I would like it to be selected automatically when clicking. I’ve tried it in every way with CSS and Jquery but it doesn’t work. I believe it is because the menus are configured with routes, then the page is reloaded and does not keep the menu active.

MENU

<div class="navi">
    <ul>
        @can('publica',Auth::user())
           <li class="active"><a href="{{route('home')}}"><i class="fa fa-home" aria-hidden="true"></i>HOME</a></li>
        @endcan
        @can('adm',Auth::user())
           <li><a href="{{route('curso_novo')}}"><i class="fa fa-graduation-cap" aria-hidden="true"></i>NOVO CURSO</a></li>
        @endcan
        @can('adm',Auth::user())
           <li><a href="{{route('aluno_cadastrar')}}"><i class="fa fa-user" aria-hidden="true"></i>NOVO ALUNO</a></li>
        @endcan
        @can('publica',Auth::user())
           <li><a href="{{route('aluno_buscar')}}"><i class="fa fa-search-minus" aria-hidden="true"></i>BUSCAR ALUNO</a></li>
        @endcan
           <li><a href="{{route('sair')}}"><i class="fa fa-sign-out" aria-hidden="true"></i>SAIR</a></li>
     </ul>
 </div>
  • I don’t know if it can help you, but try setting the Class when the page loads, not when the link is clicked. When you click the page refreshes and you lose the reference. Already when the page is loaded it reads the gift and puts the Active where you need. Another option is to use localStorage of a surveyed

No answers

Browser other questions tagged

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