I have customized the modxhost template to suit my needs and currently the wayfinder menu has one image on rollover and another one on rollout. I want the active page menu item to show the rollover image whenever the user is on the parent or child menu page and rest of the menu items to show the rollout images for veasy navigation, but am unable to do so. I am a designer and not a coder but can understand codes if shown what to do in a step by step manner.
How do I achieve this?
Your best bet is to use CSS for that. There are plenty of examples available. To get the current page to "activate" use this ’<body id="home-on">’
/*Navigation Links*/
#mainnav a#home {
background: url(../images/nav_home.jpg) no-repeat left 0px;
width: 74px;
}
/*Hover States*/
#mainnav a:hover#home {
background: url(../images/nav_home.jpg) no-repeat left;
}
/*Down States*/
body#home-on a#home {
background: url(../images/nav_home.jpg) bottom no-repeat;
}
http://ghettocooler.net/2007/05/31/simple-navigation-with-css-image-replacement/
DropboxUploader -- Upload files to a Dropbox account.
DIG -- Dynamic Image Generator
gus -- Google URL Shortener
makeQR -- Uses google chart api to make QR codes.
MODxTweeter -- Update your twitter status on publish.
Thanks guys. Figured it out by trial and error. I’ll check into your inputs to see which one is quicker.
Hi , I now this rule from CSS, but how actually do it in ModX? Because I’m using one template I cannot assign body id for each page. Does anyone knows how to tell wayfinder to highlight active menu item other way? Should be there any rule in CSS?
You can set an id for the body element. Just add <body id="[*alias*]"> to your template and it will replace the placeholder with the field value. You can use any field you want but the alias field is useful because it doesn’t contain spaces.
If you just want to set a site-wide active CSS rule rather than a different active state for different pages, you don’t need to use body id’s. Wayfinder automatically adds a class="active" attribute to the current menu item so you can just style that class.