简体   繁体   English

jquery hover + wordpress 菜单

[英]jquery hover + wordpress menus

Basically Im trying to keep the white box open when you hover off the menu.基本上,当您离开菜单时,我试图保持白框打开。 I had to position the boxes via css with absolute positioning to right now they are just showing and hiding depending on which menu-item you hover.我必须通过 position 通过 css 使用绝对定位到现在它们只是显示和隐藏,具体取决于您 hover 的哪个菜单项。 http://cl.ly/1C1c2Q1A3F3k0g1d2R0z http://cl.ly/1C1c2Q1A3F3k0g1d2R0z

    $('.menu-item-156').hover(
function() {
    $('.col').fadeIn(200).addClass('expanded');
},
function() {
    $('.col').fadeOut(200);
}
);

is what im using now and the markup in wordpress is like this:我现在使用的是什么,wordpress 中的标记是这样的:

<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>

<div class="col nav_info"><p>View the Fall '11 Collection, hot off the runway!</p></div>

wordpress spits out li elements containing the menu items wordpress 吐出包含菜单项的 li 元素

It seems you want the mouseover event, not the two-headed hover function (which is mouseover plus mouseout ).似乎您想要mouseover事件,而不是双头hover function (即mouseovermouseout )。

$('.menu-item-156').mouseover(function () {
    $('.col').fadeIn(200, function () {
        $(this).addClass('expanded');
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM