Hi
I have a question about the menu css.
I would like to have a hover, no problem. But than as well I would like on the active page, the page you visite a t that moment: a little symbol appears in the menu.
It can't be a:visited because when visited al pages have the symbol in the menu.
I thought a:current but it doesn't exist?
Can someone help out?
wasnt this menu-current?
Hello Irene.
You'll need to apply the css class to these List Items or to the A Tags of the current pages.
See the example ( by $aItemOpen):
<?php
show_menu2(
$aMenu = 0,
$aStart = SM2_ROOT,
$aMaxLevel = SM2_CURR+1,
$aOptions = SM2_ALL,
$aItemOpen = '<li [if(class==menu-current){class="active"}]>[if(class==menu-current) { [a]<span>[menu_title]</span>} else {[a][menu_title]}]</a>',
$aItemClose = '</li>',
$aMenuOpen = '<ul class="mymenu">',
$aMenuClose = '</ul>',
$aTopItemOpen = false,
$aTopMenuOpen = false
);
?>
This is just a example.
You also can use the standard SM2 behaviour, as roposed by Bramus in the post above.
However, you should read the SM2 documentation in order to fully understand this topic.
Kind Regards,
Stefek
gonna try ! Thanks, guys, let you know!
Ai doesn't work yet.
If you klick the logo appears but it should only appear when it is the page in question
http://www.idealcooking.nl/cms
Dear Irene,
you did it right.
You only forgot your css file.
Change/Expand the following selector:
#nav li a:hover {
to:
#nav li a:hover,#nav li.active a {
and you'll get there..
Kind Regards,
Stefek
Thanks Stefek, IT WORKED! :-D
There is just 1 minor thing left: the "#nav ul ul li" are shown in the menu, while I want them only to be shown when clicked on the "#nav li"
Can I delete the _ROOT from: $aStart = SM2_ROOT,
?
Do I understand right, you want this behaviour only for the parents, not for its childs?
R,
Stefek
yeah that's right!
In that case, use the following CM2 call:
( only $aItemOpen changed):
<?php
show_menu2(
$aMenu = 0,
$aStart = SM2_ROOT,
$aMaxLevel = SM2_CURR+1,
$aOptions = SM2_ALL,
$aItemOpen = '<li [if(level==0 && class==menu-current){class="active"}]>[if(class==menu-current) { [a]<span>[menu_title]</span>} else {[a][menu_title]}]</a>',
$aItemClose = '</li>',
$aMenuOpen = '<ul class="mymenu">',
$aMenuClose = '</ul>',
$aTopItemOpen = false,
$aTopMenuOpen = false
);
?>
This should do the trick.
No, wait.
This is not right.
I'll take a look further into it....
just wait a second.
It still shows the children, we should make them appear on click...
Hello Irene,
this should solve your child-items problem:
replace $aItemOpen, with the following:
$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current){ class="active"}]>[menu_title]</a>',
then, change your selector name
#nav li.active a .mymenu li a.active {
color: #efaf0f;
background-image: url(images/logomenu1.png);
background-repeat: no-repeat;
background-position: left center;
}
Will do the trick.
Let me know.
Regards,
Stefek
Hi Stefek,
That helps, the logo only appears with the parents. :lol:
Only the children shouldn't be visible at the start, only at click. Should I change their css?
I see..
you need to specify this in the $aOptions Parameter.
Please try flag SM2_TRIM instead of SM2_ALL.
There are infinite possibilities with show_menu2.
Consider to read the manual / help file ;-)
Kind regards,
Stefek
You are fantastic,
Thank you very much.
It wasn't lazyness... I just don't see the solution. But the more you try the more it seems to be logic.
anywell, Thanks a lot!
Quote from: Ogierini on March 14, 2010, 05:30:39 PM
But the more you try the more it seems to be logic.
That's right, Irene...
I am glad that I was able to help you out with this.
Regards,
Stefek
Maybe the site is tired.... but all of a suddon the menu disappears now and then.
When you click throu the website sometimes it's gne, and after clicking F5 it appears again, but that's a bit balen....
http://www.idealcooking.nl/cms/
Hello Irene,
I cant't help you with this, because I can't reproduce this bug on my browser.
But I have another hint for your show_menu2 call.
Change:
$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current){ class="active"}]>[menu_title]</a>',
into:
$aItemOpen = '<li><a href="[url]" target="[target]"[if(level==0 && class==menu-current || class==menu-parent){ class="active"}]>[menu_title]</a>',
In this case, the "icon/logo" will show in the menu on the parent, when it's child is active.
I have overseen this before.
Try it out and let me know if you like it ;-)
R,
Stefek
Yes,
this is beautifull thank you!
I haven't seen the disapear thingie again. Strange but fortunate!
Well thanks again for your help!
You're welcome!
Regards,
Stefek