我正在迁移到Bootstrap 4,目前正在修复导航栏。问题是,当我用鼠标悬停在下拉菜单上时,它们会打开。
我需要删除当用户将鼠标悬停在上方时打开的下拉菜单。我遵循了官方引导网站上的示例,因此,我不理解,悬停选项是默认启用还是其他功能?
@helper GenerateMenuItem(MenuItem menu_item)
{
if (!(menu_item.SubMenus.Where(it => it.AllowedRoles.Any(role => User.IsInRole(role))).Count() == 0 && menu_item.Url == null))
{
<li class="nav-item dropdown px-1">
@if (menu_item.SubMenus.Where(it => it.AllowedRoles.Any(role => User.IsInRole(role))).Count() > 0)
{
<a class="nav-link dropdown-toggle @menu_item.IconClass" aria-expanded="false" id="navbarDropdownMenuLink" href="@(menu_item.GetFullUrl() == null ? "javascript:" : menu_item.GetFullUrl())">@menu_item.DisplayText <span class="fa fa-caret-down"></span></a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
@foreach (MenuItem submenu_item in menu_item.SubMenus.Where(it => !it.ToSort && it.AllowedRoles.Any(role => User.IsInRole(role))))
{
@GenerateMenuItem(submenu_item)
}
@foreach (MenuItem submenu_item in menu_item.SubMenus.Where(it => it.ToSort && it.AllowedRoles.Any(role => User.IsInRole(role))).OrderBy(it => it.DisplayText))
{
@GenerateMenuItem(submenu_item)
}
</ul>
}
else
{
if (menu_item.GetFullUrl() == null)
{
<a>@menu_item.DisplayText</a>
}
else
{
<a class="dropdown-item" href="@(menu_item.GetFullUrl() == null ? "javascript:" : menu_item.GetFullUrl())">@menu_item.DisplayText</a>
}
}
</li>
}
}