【问题标题】:Bootstrap navbar-fixed-top class, not workingBootstrap navbar-fixed-top 类,不工作
【发布时间】:2023-03-27 09:05:01
【问题描述】:

使用 Bootstrap 构建投资组合网站 - 我正在应用 'navbar-fixed-top' 类以使导航栏贴在窗口顶部,例如在此示例中:

https://getbootstrap.com/examples/navbar-fixed-top/

我正在尝试使用此代码:

<nav class="navbar navbar-fixed-top">
  <div class="container">
    <div id="navbar" class="navbar-collapse">
      <ul class="nav navbar-nav">
        <li>About</li>
        <li>Projects</li>
        <li>Contact Me</li>
      </ul>
    </div>
  </div>
</nav>

但是,当我将导航栏应用到自己的网页时,它仍然可以滚动。您可以在此处查看该页面:

http://codepen.io/BenWS/pen/gmLEVw

【问题讨论】:

    标签: html css twitter-bootstrap bootstrap-4


    【解决方案1】:

    因为您使用的是最新版本的引导程序(bootstrap4 beta6)。

    它们从 .navbar-fixed-top 更改为 .fixed-top

    您必须阅读此link.中的文档

    【讨论】:

    • 是的!你说的对。但是为什么连.fixed-top 都不能在 iPhone Safari 上运行呢?
    【解决方案2】:

    我认为您在引导程序中加载的方式有问题。确保在调用引导文件之前调用 jquery。如果没有任何效果,您始终可以自己添加固定定位:

    .navbar-fixed-top {
        position:fixed !important;
    }
    

    【讨论】:

      【解决方案3】:

      在边缘、firefox、chrome 上使用 bootstrap 4
      没有点的固定顶部

      <nav class="navbar navbar-expand-lg  navbarBGcolor fixed-top">
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多