Increase Dropdown Speed of Navigation Menu in Magento 2

magento-2.1magento2navigationsubmenutopmenu

by default nav-menu drop-down is so slow so I want the increase the drop-down time of nav-menu..

Till now I tried editing the two files but no success..
files edited: js/navigation-menu.js, Magento_Theme/menu.js

Hope some one help me to achieve this.

Best Answer

In your theme, make this file:

Your/theme/Magento_Theme/templates/html/topmenu.phtml

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Top menu for store
 *
 * @var $block \Magento\Theme\Block\Html\Topmenu
 */
?>
<?php $columnsLimit = $block->getColumnsLimit() ?: 0; ?>
<?php $_menu = $block->getHtml('level-top', 'submenu', $columnsLimit) ?>

<nav class="navigation" data-action="navigation">
    <ul data-mage-init='{"menu":{"delay":150, "responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
        <?php /* @escapeNotVerified */ echo $_menu; ?>
        <?php /* @escapeNotVerified */ echo $block->getChildHtml(); ?>
    </ul>
</nav>

The key ingredient is the delay option in the menu initialization. The default value is 300 milliseconds so here I set it to 150.

Related Topic