show active menu tab when visiting page
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
show active menu tab when visiting page
I'm running Joomla! 3.7.2.
No matter what page I'm on, the "Home" tab on the main menu shows an active state. One forum member suggested replacing all the class ".active" with a new class ".current". I don't know how "current" is different from "active".
Other advice I read was to go into Extensions, Modules, Main Menu, and set "Base Item" to "current" - but all I can do there is select a Menu Item (one of the articles).
In the Main Menu Advanced panel the Menu class Suffix is " nav-pills" (space in front of "nav"). Module Class Suffix "_menu" and Module Tag "nav".
Could someone please advise?
Thank you!
No matter what page I'm on, the "Home" tab on the main menu shows an active state. One forum member suggested replacing all the class ".active" with a new class ".current". I don't know how "current" is different from "active".
Other advice I read was to go into Extensions, Modules, Main Menu, and set "Base Item" to "current" - but all I can do there is select a Menu Item (one of the articles).
In the Main Menu Advanced panel the Menu class Suffix is " nav-pills" (space in front of "nav"). Module Class Suffix "_menu" and Module Tag "nav".
Could someone please advise?
Thank you!
- websitedons
- I've been banned!
- Posts: 389
- Joined: Sat May 27, 2017 9:42 am
Re: show active menu tab when visiting page
Do you have a code inspector on your browser? If yes, right click on the home menu item when on a different page, then view the <li> element that wraps the <a>, and determine if the .active class is included. The .current class is applied to parent items when a child item is active.
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
Re: show active menu tab when visiting page
Thank you for your reply!
I did what you said and found the current class stays in the list menu item for "Home" no matter what link I'm on.
I have drop-downs, but not on all the menu items. Could this have anything to do with it?
Also, the back-end configuration for Menu Modules has changed in 3.7.2. There is no way to set the Base Item to "Current", so do I have to hard-code the template? If so, won't it change with each update?
I did what you said and found the current class stays in the list menu item for "Home" no matter what link I'm on.
I have drop-downs, but not on all the menu items. Could this have anything to do with it?
Also, the back-end configuration for Menu Modules has changed in 3.7.2. There is no way to set the Base Item to "Current", so do I have to hard-code the template? If so, won't it change with each update?
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
I'm working on 3 new Joomla 3.7.2 sites, all using Protostar with just minimal colour changes and have now run into this exact same problem on one of the sites. The one I have the problem with started off on 3.7.1. I'm not too sure when the problem started so I don't know if it was there from the get go. At first I thought it was just with Protostar and spent a lot of time checking out the CSS but I have the same problem with Beez3 and other Bootstrap based templates that I use on other sites. So I am assuming something deeper in Joomla
So much time so much effort and no further. I have now started a fresh site and will have to copy all the content over but I'm nervous because I don't know how this problem was caused and whether it could come back after a this re-build. Its very disconcerting
If anyone has an answer I'm all ears
So much time so much effort and no further. I have now started a fresh site and will have to copy all the content over but I'm nervous because I don't know how this problem was caused and whether it could come back after a this re-build. Its very disconcerting
If anyone has an answer I'm all ears
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
Re: show active menu tab when visiting page
jguy, I'm not sure when it started either, but I'm past deadline to launch this site and looking all over for a solution. Was tempted to just make a new menu, but don't want to do that and end up with the same result. Surely there's a solution. Please, someone - tell us what it is.
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
I was just about to go live too but had to put a stop to that
I did create a whole new second menu structure, but its afflicted with the same problem
Overnight I have been trying to retrace my development steps (restoring each one of my many backups) trying to determine at what point it went wrong, because I only noticed some time later. I may have come across a lead. Early in my setup, I decided to implement the SSL cert that my reseller account has. This is one of those universal ones that is apparently enabled at cPanel account creation time. I have always used individual certs in the past, so had no knowledge this approach and now I'm wondering whether it was at this point things went wrong. After reading up on SSL with regards to Joomla I also turned on the configuration option to "Force SSL to entire site"
Anyway I'm off to remove all these settings and turn off htaccess to see if there is any difference. Will post the result here later
I did create a whole new second menu structure, but its afflicted with the same problem
Overnight I have been trying to retrace my development steps (restoring each one of my many backups) trying to determine at what point it went wrong, because I only noticed some time later. I may have come across a lead. Early in my setup, I decided to implement the SSL cert that my reseller account has. This is one of those universal ones that is apparently enabled at cPanel account creation time. I have always used individual certs in the past, so had no knowledge this approach and now I'm wondering whether it was at this point things went wrong. After reading up on SSL with regards to Joomla I also turned on the configuration option to "Force SSL to entire site"
Anyway I'm off to remove all these settings and turn off htaccess to see if there is any difference. Will post the result here later
- Per Yngve Berg
- Joomla! Master
- Posts: 30809
- Joined: Mon Oct 27, 2008 9:27 pm
- Location: Romerike, Norway
Re: show active menu tab when visiting page
Turn off SEF in Global Configuration and check that htere is an Itemid=xx on the links.
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
Well I reverted the whole site back to basic settings including turning off SEF in Global Configuration. The item ids are working fine in non SEF mode but alas no success on any menu tab receiving the active status except for Home tab
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
Re: show active menu tab when visiting page
I found this post under Administration Joomla! 3.x topics and I changed the xml like it instructed, but it didn't work for me: viewtopic.php?t=951300
Someone also gave a link to a patch which I will try to do: https://github.com/joomla/joomla-cms/pull/16459
Someone also gave a link to a patch which I will try to do: https://github.com/joomla/joomla-cms/pull/16459
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
I have now also tried that xml change but to no avail
I also noticed another one of my new test sites that I installed quickly a week ago via "installatron" on my hosting has now gone bad in the same way and have no idea why. Something I am doing is triggering this fault
So today I have manually installed Joomla using my own naming standards and usual path obfuscations to see if I can make things go wrong. So far the site is holding up. I have created multiple menus items and have a secondary menu in play with no problems
I also noticed another one of my new test sites that I installed quickly a week ago via "installatron" on my hosting has now gone bad in the same way and have no idea why. Something I am doing is triggering this fault
So today I have manually installed Joomla using my own naming standards and usual path obfuscations to see if I can make things go wrong. So far the site is holding up. I have created multiple menus items and have a secondary menu in play with no problems
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
Re: show active menu tab when visiting page
So the 'current' menu link appears different than the rest of the menu links in the new installation?
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
On a fully working site I am getting this style on the active "home" tab "class="item-101 default current active"
While this state is true the other tabs are left plain
If another menu tab other than "home" is current the styling is "item-108 current active"
and the "home" is then styled "item-101 default"
While this state is true the other tabs are left plain
If another menu tab other than "home" is current the styling is "item-108 current active"
and the "home" is then styled "item-101 default"
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
On my site that has gone bad after a lot of content updates I just didn't want to start from scratch again especially since I can't prevent it happening again I have now installed a menu extension from the Joomla directory called "GiMeSpace Bootstrapped Menu" found at http://joomla.gimespace.com or through the installer
This has added some missing Bootstrap classes and solved the problem for now
This has added some missing Bootstrap classes and solved the problem for now
-
- Joomla! Apprentice
- Posts: 28
- Joined: Thu Jul 26, 2012 4:43 pm
Re: show active menu tab when visiting page
Well, I downloaded the latest version and started over. The menu is working fine. Unfortunately, I'll never know what caused the other menu to break, since I don't have the time. Thank you to everyone who offered help.
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
Yes, and not knowing makes future development nervous. I am now backing up on each iteration rather than every few hours of work. Slowly becoming paranoid!
-
- Joomla! Apprentice
- Posts: 31
- Joined: Thu Nov 01, 2007 5:30 pm
Re: show active menu tab when visiting page
I have been having the same problem using ProtoStar on Joomla 3.8.3 with a bilingual site. I ended up having to style the current, active and default classes to get it to highlight the menu tab for the current page and not highlight the menu tab for home when on a different page, but highlight it when on the home page and treat the hover correctly.
This is the code that I put in user.css.
Hope this helps somebody, as it took a bit of experimenting to figure out.
This is the code that I put in user.css.
Code: Select all
.nav-pills > .current > a {background: #158cc1; color: #fff;}
.nav-pills > .current > a:hover {background: #fff; color: #000;}
.nav-pills > .default.active > a {background: #fff; color: #158cc1;}
.nav-pills > .default.active > a:hover {background: #fff; color: #000;}
.nav-pills > .default.current.active > a {background: #158cc1; color: #fff;}
-
- Joomla! Apprentice
- Posts: 41
- Joined: Mon May 08, 2006 1:18 pm
- Location: UK
Re: show active menu tab when visiting page
Thanks for adding that tip Madeleine
Might need it in the future but so far have not had that problem again with many new sites under the belt
Might need it in the future but so far have not had that problem again with many new sites under the belt
-
- Joomla! Fledgling
- Posts: 2
- Joined: Tue Nov 20, 2007 12:03 am
Re: show active menu tab when visiting page
Thank you Madeleine. Works for me.
-
- Joomla! Fledgling
- Posts: 1
- Joined: Sat Feb 23, 2019 10:20 pm
Re: show active menu tab when visiting page
I have figured this out! In the modules for the menu, clear the selection so that
Base Item shows as "Current".
Base Item shows as "Current".