Hello Friends!
In this blog, we are going to learn how we can place a submenu at the right adjacent position of its parent menu.
In Magento 2, when we create a category menu with multiple levels then you can see the sub-sub menu position will be fixed as the following images:
Here, we can change the position of the sub-sub menu by making changes in <magento-root-directory>/lib/web/css/source/lib/_navigation.less file at line number 462 and 468.
// top: 0 !important; //old statement
top: 0; //new statement
left: 100% !important;
}
.submenu-reverse{
// left: auto !important; //old statement
left: auto; //new statement
right: 100%;
}
Now, make changes in topmenu.phtml file inside <magento-root-directory>/vendor/module-theme/view/frontend/templates/html/ directory.
Replace the following statement at line number 18
with the new statement as following
After making the above changes, run php bin/magento setup:upgrade command and flush the magento cache.
Then check the menu on frontend and the result will be displayed as follows:
Hope this will be helpful. Thanks ????