Glad to be out here on Stack Overflow :)
I recently implemented some Jquery fade in/fade out code for my WordPress menu. I actually used the code found here at this resource. Apparently, it seems like a piece of Jquery code that's pretty commonly used.
I was able to get it incorporated into my WordPress menus. Everything works great on the primary navs. However, the sub menus adopt the same height and Jquery effect of the primary nav which I do not want. I'd like the sub menus to be thinner and just have a simple background color change.
My question is how I can get the styles of the primary and sub navs to be independent of each other while using this great jquery script. I've pasted the relevant css code and was hoping someone might be able to offer some insight. It's based off of the standard wordpress menu css and am hoping it's pretty self-explanatory.
#access {
margin:0;
padding:0;
list-style:none;
line-height:60px;
}
#access ul {
font-size: 16px;
font-family: 'swis721_ltcn_btlight';
text-transform:uppercase;
list-style: none;
margin: 0 0 0 -0.8125em;
padding-left: 0;
display:inline-block;
text-align: center;
}
#access li {
float:left;
background:url(images/default.jpg) no-repeat center center; /
width:150px;
height: 50px;
position:relative;
}
#access li a {
z-index:20;
display:block;
position:relative;
color:#777;
border-right: 1px dotted #cccccc;
}
#access li .hover {
background:url(images/over.jpg) no-repeat center center;
position:absolute;
width:150px;
height:50px;
left:0;
top:0;
z-index:0;
display:none;
}
#access ul ul {
height: 17px !important;
-moz-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
-webkit-box-shadow: 0 3px 3px rgba(0,0,0,0.2);
box-shadow: 0 3px 3px rgba(0,0,0,0.2);
display: none;
float: left;
margin: 0;
position: absolute;
top: 50px;
left: 0;
width: 150px;
z-index: 99999;
}
#access ul ul a {
background:#ccc;
border-top: 1px dotted #ffffff;
border-bottom: 1px dotted #ffffff;
color: #FFF;
font-size: 12px;
font-weight: normal;
line-height: 1.1em;
text-align: left;
padding: 5px 10px;
width: 130px;
height: 17px;
}
#access ul ul :hover > a {
height:17px !important;
}
Basically, when I attempt to change the sub menus styles in "#access ul ul a" or"#access ul ul :hover > a" the heights and hover effects of the primary nav carry over.
I've included a link to an example of the issue. If you hover over 'events and services' you'll see the sub menu issue.
http://streetsmartetiquette.com/wordpress/about/
Jquery Code added below as well:
jQuery(document).ready(function($) {
//Append a div with hover class to all the LI
$('#menu-navmenu li').append('<div class="hover"><\/div>');
$('#menu-navmenu li').hover(
//Mouseover, fadeIn the hidden hover class
function() {
$(this).children('div').stop(true, true).fadeIn('1000');
},
//Mouseout, fadeOut the hover class
function() {
$(this).children('div').stop(true, true).fadeOut('1000');
}).click (function () {
//Add selected class if user clicked on it
$(this).addClass('selected');
});
});
Thanks all for the help!