Reputation: 23
I have this css code and I need to do this: I have a dropdown menu with 5 items. Item1 (root) -Item2 -Item3 -Item4 -Item5
When I'm inside the page for example "Item4" I need that the "Item4" menu item and the "Item1 (root)" menu item are highlighted with a same color.
Thanks so much.
.menu-container{
}
.de-menu {
color:#333;
font-family:'Ovo';
font-weight:400;
font-size:13px;
letter-spacing:3px;
text-transform:uppercase;
float:right;
}
.de-menu {
display:inline-block;
padding:0px 0px 0px 0px;
margin:10px 0px 0px 0px;
height:93px;
}
.de-menu li {
padding:0px 0px 0px 0px;
margin:0px 0px 0px 0px;
float:left;
display:inline;
list-style:none;
position:relative;
}
.de-menu a {
display:block;
padding:35px 14px 34px 14px;
line-height:30px;
text-decoration:none;
color:#fff;
}
.de-menu .current-menu-item a{
color:#e8c694;
}
.de-menu .current-menu-parent a{
color:#e8c694;
}
/*.de-menu .active a {
color:#red;
}*/
.de-menu li ul{
box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 8px 0 rgba(0, 0, 0, 0.3);
margin-left:25px;
padding:0;
}
.de-menu li li {
font-size:12px;
letter-spacing:normal;
text-transform:uppercase;
}
.de-menu li li a{
padding:5px 15px 5px 15px;
background:#64483E;
border-top:none;
}
.de-menu a:hover {
background:#64483E;
}
.de-menu li li a:hover{
border-top:none;
}
.de-menu li li a:hover {
background:url(../images/dotblack30.png) #513D32;
}
.de-menu li ul {
width:170px;
height:auto;
position:absolute;
top:100%;
left:-25px;
z-index:10;
display:none;
text-align:left;
}
.de-menu li li {
display:block;
float:none;
}
.de-menu li li ul{
margin-left:0;
}
.de-menu li:hover > ul {
display:block;
}
.de-menu li ul ul {
left:100%;
top:0px;
}
.de-menu li:hover a {
background:#64483E;
}
.de-menu select {padding:10px; height:36px; font-size:14px; border:none; background:#513D32; color:#fff;}
.de-menu select option{padding:10px;}
Upvotes: 2
Views: 650
Reputation: 46
In my CSS file, "active" class has highlighting css values like
"background-color: #FFFFFF"
I'm using these in each page:
<script>
document.getElementById("PAGE_MENU_NAME_1").className = "active";
</script>
OR
<script>
document.getElementById("PAGE_MENU_NAME_2").className = "active";
</script>
OR
<script>
document.getElementById("PAGE_MENU_NAME_3").className = "active";
</script>
Use one of above for which page you are viewing.
This is my master page like "Menu.php"
<ul id="menu">
<li id="PAGE_MENU_NAME_1"><a href="page1.php">PAGEMENUNAME1"</a></li>
<li id="PAGE_MENU_NAME_1"><a href="page2.php">PAGEMENUNAME2"</a></li>
<li id="PAGE_MENU_NAME_3"><a href="page3.php">PAGEMENUNAME3"</a></li>
</ul>
I hope you get what I said.
Upvotes: 0
Reputation: 947
(this style is already in stylesheet around line 275, so just need to add background color)
.de-menu .current-menu-parent a {
background: #64483E;
}
(this would be to add to style sheet):
.de-menu .current-menu-parent .sub-menu .current-menu-item a {
background: url("../images/dotblack30.png") #513D32;
}
Upvotes: 0