减慢对MegaMenu的幻灯片效果

时间:2016-03-01 05:44:43

标签: jquery drop-down-menu megamenu

我有这个megamenu工作,但它很笨重。所以我试图通过一些额外的jQuery(这是你在下面看到的第二部分代码)来减慢滑动效果。到目前为止,我似乎抓住了错误的元素。我应该在jQuery代码的最后一部分放置哪些元素来定位下拉菜单项,而不是整个菜单?现在,整个菜单在点击时消失,而不是单个元素。

jQuery(document).ready(function(jQuery) {
    var menu = jQuery('#mega-menu-wrap-secondary'); // change this to target your menu

    // do not edit below this line
    jQuery('li.mega-menu-item', menu).on('open_panel', function(e) {
        var sub_menu = jQuery('.mega-sub-menu', jQuery(this));
        menu.css('margin-bottom', sub_menu.height());
    });
    jQuery('li.mega-menu-item', menu).on('close_panel', function(e) {
        menu.css('margin-bottom', '');
    });
});

jQuery(document).ready(function(){
    jQuery(".mega-menu").mouseenter( function() {
        jQuery("li.mega-menu-item").slideDown(1000);
    });

    jQuery(".mega-menu").mouseleave( function() {
        jQuery("li.mega-menu-item").slideUp(1000);
    });
});

0 个答案:

没有答案
相关问题