jquery hover + wordpress菜单

时间:2011-07-07 14:15:14

标签: javascript jquery wordpress

基本上当我将鼠标悬停在菜单上时,我试图让白框保持打开状态。我必须通过绝对定位的css来定位盒子,现在它们只是显示和隐藏,具体取决于你悬停的菜单项。 http://cl.ly/1C1c2Q1A3F3k0g1d2R0z

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

是我现在使用的,而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吐出包含菜单项的li元素

1 个答案:

答案 0 :(得分:1)

您似乎想要mouseover事件,而不是双头hover功能(mouseovermouseout)。

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