加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

html – 单击菜单外部以关闭它时,Bootstrap导航栏“闪烁”

发布时间:2020-12-14 16:45:25 所属栏目:资源 来源:网络整理
导读:我在导航栏中遇到问题,当您在菜单外部单击以关闭菜单时会出现“闪烁”.如果在单击菜单时按住鼠标,闪烁仍然存在,如下所示: 我认为它可能与角度有关,而不是css,主要是因为其他人未能在小提琴上复制它. Previous question here. HTML: nav class='navbar navb
我在导航栏中遇到问题,当您在菜单外部单击以关闭菜单时会出现“闪烁”.如果在单击菜单时按住鼠标,闪烁仍然存在,如下所示:

我认为它可能与角度有关,而不是css,主要是因为其他人未能在小提琴上复制它. Previous question here.

HTML:

<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的一部分,它引用了导航栏包含的文件

<body>
 <div class="view-container">
     <div ng-view class="view-frame"></div>
 </div>
</body>

我认为这个问题可能与ng-view或ng-include有关,但到目前为止,上一个问题中没有任何修复工作.

解决方法

一个快速黑客可能会将此添加到您的CSS
.nav >li > a:hover,.nav > li > a:focus {
    background-color: #586F7C;
}

编辑:我刚刚意识到你已经在另一个线程中看到过这样的解决方案,但我能够复制“你的错误”. Here is a bootply,只是试着注释掉css并且bug将会出现,css正如预期的那样工作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读