0

I am trying to display sub-menu items and a div at the same time in Wordpress Genesis. But when I hover on the div the sub-menu disappear.

I am using the following code but it doesn't work

.sbclass:hover + #nav li:nth-child(3):hover ul, 
#nav li:nth-child(3) ul, 
#nav li:nth-child(3).sfHover ul, 
#nav li:nth-child(3) .submenu {
    visibility:visible !important;
    display:block !important;
}

You can check the third nav menu item menu here

http://174.120.233.154/~a348/nextmktg/jle/ 
cernunnos
  • 2,766
  • 1
  • 18
  • 18
David
  • 3
  • 2

1 Answers1

-1

** The original post ended with the poster asking how to approach his problem with mouseenter/mouseleave, that is why this a javascript response to his css question **

Welp, your using jquery, so the most basic approach is below. There are prettier ways to do it as well.

$('selector').on('mouseenter', function(){
  $(this).addClass('open');
});
$('selector').on('mouseleave', function(){
  $(this).removeClass('open');
});

More here: Combining jquery functions - on() hover/mouseenter/mouseleave
And here: http://api.jquery.com/on/

Community
  • 1
  • 1
Jason Lydon
  • 7,074
  • 1
  • 35
  • 43
  • Why are you suggesting a Javascript solution to a pure CSS problem? Whilst sometimes valid, you'd need very good reason to, which I don't see in this case. – Niels Keurentjes Apr 17 '13 at 16:36
  • @Niels do you have any solution using pure CSS? – David Apr 17 '13 at 17:07
  • @user2291220 Yes, Billy Matthews already suggested the right answer - you need a common parent to make this work. I'm willing to look at a practical implementation if I have a base JSfiddle to work from. – Niels Keurentjes Apr 17 '13 at 18:22
  • @JasonLydon my confusion arises from the fact that I, nor many people after me, will read all those comments before scrolling to the answer. The given answer does not support the original question, so one of the two or both need some rewriting to explain how you came from A to B. I'll remove the downvote though since it is on topic after all, my apologies (can't remove it now because of time since last edit). – Niels Keurentjes Apr 17 '13 at 18:24