How to make nav-link active |
I was trying to make class="nav-link" active every time I clicked the navbar navigation. So, for example, I have 5 navbar navigation. Home, About, Contact, Comic, and People. When I click the Home, the class of class="nav-link" will be active. So, it will become class="nav-link active". Then, when I click another navbar navigation, for example About, the class="nav-link active" at Home navbar navigation, will disappear and will appear again in the About navbar navigation. So the class from the navbar navigation of About will be class="nav-link active" while Home become class="nav-link" again. It's kinda hard to explain but I hope I explain it correctly ) And sorry for the bad grammar lolll. But anyway, here is my current code, I tried it with flash data on the controller like in the screenshot. Then, I destroy the session and make a new one. Is there any alternative code to make it? Like, more simpler code? Or easier code??
Screenshots: https://i.imgur.com/I16sK93.png https://i.imgur.com/RvgJmqg.png
Some thing like this.
PHP Code: // in your controller set the page name What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(05-05-2024, 10:41 PM)InsiteFX Wrote: Some thing like this. Yeah this one is work for me as well. Thanks for the help! |
Welcome Guest, Not a member yet? Register Sign In |