autonav problems
Permalink 1 user found helpful
Hi everyone,
I have a small issue that none the less is a pain in the butt.
It concerns my autonav, which is dropdown menu that displays the menus as ul ul.
My problem is that if I have one of the sub menu items as active (the chosen menu item), I would like to have the parent li item to be selected so that the guets at my site visually can see that this is the parent of the active sub menu item.
I simply can´t get this to work in any way.
I have the following code in my view.php of my autonav, where the problem is:
Can anyone help me to achive what I am asking for?
The problem is that the class "nav-path-selected" becomes active in both "Home" and the list item containing my sub menu, so I can not target it correctly with my css.
For a better view please go to:http://l0calhost.dk/blog/my-first-blog-post/... and check the html source code
I have a small issue that none the less is a pain in the butt.
It concerns my autonav, which is dropdown menu that displays the menus as ul ul.
My problem is that if I have one of the sub menu items as active (the chosen menu item), I would like to have the parent li item to be selected so that the guets at my site visually can see that this is the parent of the active sub menu item.
I simply can´t get this to work in any way.
I have the following code in my view.php of my autonav, where the problem is:
if (!$pageLink) { $pageLink = $ni->getURL(); } /*if ($c->getCollectionID() == $_c->getCollectionID()) { echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() . '</a>'); } elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) ) { echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '" ' . $target . '>' . $ni->getName() . '</a>'); } else { echo('<li><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() . '</a>'); } $lastLevel = $thisLevel; $i++;*/ if ($c->getCollectionID() == $_c->getCollectionID()) { echo('<li class="nav-selected nav-path-selected great"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() . '</a>'); } elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
Viewing 15 lines of 21 lines. View entire code block.
Can anyone help me to achive what I am asking for?
The problem is that the class "nav-path-selected" becomes active in both "Home" and the list item containing my sub menu, so I can not target it correctly with my css.
For a better view please go to:http://l0calhost.dk/blog/my-first-blog-post/... and check the html source code
The behaviour is correct. nav-path-selected is applied to all ancestors of the current page in your autonav tree.
The way you should handle this is to define your .nav-path-selected before your .nav-selected definition and that your .nav-selected over-rides anything you want to over-ride from your .nav-path-selected.
The way you should handle this is to define your .nav-path-selected before your .nav-selected definition and that your .nav-selected over-rides anything you want to over-ride from your .nav-path-selected.
Yes I run into this problem all the time. I submitted a bug report last week for it so hopefully it will be fixed in the future.
In the meantime, you can fix it yourself by changing this line:
to this:
-Jordan
In the meantime, you can fix it yourself by changing this line:
} elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) ) {
to this:
} elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) && ($_c->getCollectionID() != HOME_CID) ) {
-Jordan
Hi Jordan,
I just implemented the code you supplied
But it deosn´t seem to do any difference source wisehttp://l0calhost.dk
I still have the issue and nothing really changed ?
//Carsten
I just implemented the code you supplied
} elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) && ($_c->getCollectionID() != HOME_CID) ) {
But it deosn´t seem to do any difference source wisehttp://l0calhost.dk
I still have the issue and nothing really changed ?
//Carsten
I went to your site and viewed the source and it looks like it's working to me -- the home link in the autonav does not have the "nav-path-selected" class.
Did you update your CSS to work with .nav-path-selected (now that the HOME page won't have that class)?
Or were you expecting something else to happen? Maybe my solution is for a different problem than you're having?
Did you update your CSS to work with .nav-path-selected (now that the HOME page won't have that class)?
Or were you expecting something else to happen? Maybe my solution is for a different problem than you're having?
Hi again Jordan,
Yeah MY BAD, you are quite right, but I focused on the actual menu link that I was on instead of viewing the entire source.
I can see that the nav-path-selected indeed has vanished from my HOME menu link.
Thank you Jordan, I will try and correct the css so that it reflects this new change.
Thanks for the work around :0)
//Carsten
Yeah MY BAD, you are quite right, but I focused on the actual menu link that I was on instead of viewing the entire source.
I can see that the nav-path-selected indeed has vanished from my HOME menu link.
Thank you Jordan, I will try and correct the css so that it reflects this new change.
Thanks for the work around :0)
//Carsten
I accidently put toomuch code in the first time.
The actual code is this:
//Carsten - Denmark