如何修改这个Mega菜单的悬停速度?

时间:2014-04-25 19:23:51

标签: jquery drop-down-menu hover settimeout megamenu

我正在尝试修改此超级菜单的鼠标速度或悬停速度,当用户将鼠标悬停在按钮上时,下拉菜单启动前会有0.3秒的延迟。这是实际网站http://adobe-accessibility.github.io/Accessible-Mega-Menu/

和jquery:http://adobe-accessibility.github.io/Accessible-Mega-Menu/js/jquery-accessibleMegaMenu.js

感谢任何提示。

提前致谢, 瑞克

2 个答案:

答案 0 :(得分:0)

是的,请检查megamenu.css文件第139和151行,只需更改过渡轻松的值。

    -webkit-transition: opacity 250ms ease 250ms, max-height 500ms ease, visibility 0s linear 500ms, top 0s linear 500ms;
       -moz-transition: opacity 250ms ease 250ms, max-height 500ms ease, visibility 0s linear 500ms, top 0s linear 500ms;
        -ms-transition: opacity 250ms ease 250ms, max-height 500ms ease, visibility 0s linear 500ms, top 0s linear 500ms;
         -o-transition: opacity 250ms ease 250ms, max-height 500ms ease, visibility 0s linear 500ms, top 0s linear 500ms;
            transition: opacity 250ms ease 250ms, max-height 500ms ease, visibility 0s linear 500ms, top 0s linear 500ms;

    border: 1px solid rgba(0,0,0,0.3);
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
}

.accessible-megamenu .accessible-megamenu-panel.open {
    visibility: visible;
    top: 3em;
    max-height: 1200px;
    opacity: 1;
    z-index: 1001;
    -webkit-transition: opacity 250ms ease, max-height 500ms ease, visibility 0s linear 0s, top 0s linear 0s;
       -moz-transition: opacity 250ms ease, max-height 500ms ease, visibility 0s linear 0s, top 0s linear 0s;
        -ms-transition: opacity 250ms ease, max-height 500ms ease, visibility 0s linear 0s, top 0s linear 0s;
         -o-transition: opacity 250ms ease, max-height 500ms ease, visibility 0s linear 0s, top 0s linear 0s;
            transition: opacity 250ms ease, max-height 500ms ease, visibility 0s linear 0s, top 0s linear 0s;
}

我希望这对你有所帮助。

问候。

答案 1 :(得分:0)

我实际上是想通过JQuery来做这件事。以下代码在鼠标输出时使用.3秒延迟但是我不确定如何使其适用于MouseOver:

 _mouseOverHandler =  function (event) {
        clearTimeout(this.mouseTimeoutID);
        $(event.target) 
            .addClass(this.settings.hoverClass);
        _togglePanel.call(this, event);  
        if ($(event.target).is(':tabbable')) {
            $('html').on('keydown.accessible-megamenu', $.proxy(_keyDownHandler, event.target));
        }
    };

    /**
     * @name jQuery.fn.accessibleMegaMenu~_mouseOutHandler
     * @desc Handle mouseout event on mega menu.
     * @param {event} Event object
     * @memberof jQuery.fn.accessibleMegaMenu
     * @inner
     * @private

     Exit Time is now .300 seconds

     */
    _mouseOutHandler = function (event) {
        var that = this;
        $(event.target)
            .removeClass(that.settings.hoverClass);

        that.mouseTimeoutID = setTimeout(function () {
            _togglePanel.call(that, event, true);
        }, 300);
        if ($(event.target).is(':tabbable')) {
            $('html').off('keydown.accessible-megamenu');
        }
    };