Wordpress menu-item-hover

admin

Administrator
Staff member
I'm trying to create a custom drop down menu.

my code looks like:

Code:
<div id="header"> </div>

      <div class="layer1_col">
        <?php wdg::displayMenu('main'); ?>
      </div>

      <div class="programmingTable"></div>
      <div id="main">

The wdg::displayMenu('main'); generates the menu created in the wordpress backend called "main", obviously. theres no changing the wdg because i need to use it.

And i'm trying to edit menu-item-12, when i edit the site in chrome this is how the menu is build( that's how i got to the menu-item-12).

Code:
<ul id="menu-main" class=""><li id="menu-item-96" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-96"><a href="http://jouwfm.100200.nl/">NIEUWS</a></li>
<li id="menu-item-103" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-103"><a href="http://jouwfm.100200.nl/archief/">ARCHIEF</a></li>
<li id="menu-item-12" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-12"><a>PROGRAMMERING</a></li>
<li id="menu-item-97" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-97"><a href="http://jouwfm.100200.nl/vacatures/">VACATURES</a></li>
<li id="menu-item-102" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-102"><a href="http://jouwfm.100200.nl/adverteren/">ADVERTEREN</a></li>
<li id="menu-item-27" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27"><a href="http://jouwfm.100200.nl/contact/">CONTACT</a></li>
</ul>

Whereas menu-item-12 isn't a real menu item. It has no link connected to it, the div ( .programmingTable) is going to be filled with all different posts, but thats aside of the question).

My css looks like:

Code:
.programmingTable{
  display:none;
  margin-left: 10px;
  margin-right: 10px;
  padding: 0;
  height: 380px;
  line-height: 1.5em;
  background-color: #e3e3e3;
  position: absolute;
  z-index: 5;
  width: 934px;
  top: 87px;
  padding-left: 8px;
  padding-right: 8px;
  padding-top: 45px;
  border-bottom-left-radius: 8px;
  -moz-border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  -moz-border-bottom-right-radius: 8px;
  -webkit-box-shadow: 0 7px 9px rgba(50,50,50,0.41);
  -moz-box-shadow: 0 7px 9px rgba(50,50,50,0.41);
  box-shadow: 0 7px 9px rgba(50,50,50,0.41);
  background: -webkit-gradient(linear,0% 0,0% 90%,from(#d9d9d9),to(#fbfbfb));
  background: -webkit-linear-gradient(top,#d9d9d9,#fbfbfb);
  background: -moz-linear-gradient(top,#d9d9d9,#fbfbfb);
  background: -ms-linear-gradient(top,#d9d9d9,#fbfbfb);
  background: -o-linear-gradient(top,#d9d9d9,#fbfbfb);
}

#menu-item-12:hover .programmingTable{
  display:block;
}

Also tried using opacity, z-index. Where z-index would work but the rest of the div's arent the same colour. It doesn't look right.

I've already tried to use jquery to make it happen using this:

Code:
  jQuery('#menu-item-12').mouseover(

    jQuery(document).ready( function() {
      jQuery('.programmingTable').fadeIn(200)
    })
  );
  jQuery('#menu-item-12').mouseleave(

    jQuery(document).ready( function() {
      jQuery('.programmingTable').fadeOut(200)
    })
  );

This doesn't work. Well half i guess. It makes the item fade in and then fade out again, once on pageload. It doesn't do anything when hovering over the div in question.

I've been stuck on this problem a few days now, any help would be appreciated.

A better example on what i mean is on <a href="http://www.jouwfm.nl" rel="nofollow">this site</a> hover over "Programmering".

EDIT: here's the class on displayMenu

Code:
 static public function displayMenu( $name, $atts=array( ))
{
  // Getting/Setting the variablen
  extract( shortcode_atts( array( 'container'      =&gt; 'div',
                                  'containerid'    =&gt; '',
                                  'containerclass' =&gt; '',
                                  'menuid'         =&gt; '',
                                  'menuclass'      =&gt; '',
                                  'afterlabel'     =&gt; '',
                                  'beforelabel'    =&gt; '',
                                ), $atts
         ));

  wp_nav_menu( array( 'menu'            =&gt; $name,
                      'menu_id'         =&gt; $menuid,
                      'menu_class'      =&gt; $menuclass,
                      'link_before'     =&gt; $beforelabel,
                      'link_after'      =&gt; $afterlabel,
                      'container'       =&gt; $container,
                      'container_id'    =&gt; $containerid,
                      'container_class' =&gt; $containerclass,
                    ));
}