我在导航栏上遇到了一个问题,当你点击菜单以外的地方关闭菜单时会出现“闪烁”的情况。如果在点击菜单以外的地方时按住鼠标不放,闪烁会持续存在,如下图所示:
<nav class='navbar navbar-default.navbar-static-top navbar-custom'>
<div class='container-fluid'>
<ul class='nav navbar-nav navbar-left'>
<li><a href="dashboard.html">Dashboard</a></li>
<li><a href="/grades">Grades</a></li>
<li><a href="/classes">Classes</a></li>
</ul>
<ul class='nav navbar-nav navbar-right'>
<li><a href="/messages"><i class="fa fa-envelope fa-lg"></i></a></li>
<!--has to do with the link, clicking it and clicking it again-->
<li><a class="dropdown-toggle dropdown-custom" data-toggle="dropdown" href="/profile"><i class="fa fa-user fa-lg"></i></a>
<ul class="dropdown-menu">
<li><a href="/profile.html">Edit profile</a></li>
<li><a href="/settings">Edit Preferences</a></li>
</ul>
</li>
<li><a href="/logout"><i class="fa fa-power-off fa-lg"></i></a></li>
</ul>
</div>
</nav>
CSS:
[ng\:cloak], [ng-cloak], .ng-cloak {
display: none !important;
}
.navbar-custom {
background-color: #586F7C;
}
.navbar-custom a {
color: #F4F4F9;
}
.navbar-custom .nav > li > a:hover {
background-color: #2F4550;
}
.navbar .navbar-nav > li.open > a, {
background-color: #586F7C;
}
.navbar .navbar-nav > li.open > a:hover,
.navbar .navbar-nav > li.open > a:focus {
background-color: #2F4550;
}
.nav >li > a:hover, .nav > li > a:focus {
background-color: #586F7C;
}
在引用导航栏的文件中使用ng-include。
<div ng-include="'html/navbar.html'"></div>
index.html中引用导航栏ng-include文件的部分
<body>
<div class="view-container">
<div ng-view class="view-frame"></div>
</div>
</body>
我认为问题可能出在ng-view或ng-include上,但到目前为止,之前问题中的解决方法都没有奏效。