Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 带引导的静态导航条_Css_Twitter Bootstrap 3_Navbar - Fatal编程技术网

Css 带引导的静态导航条

Css 带引导的静态导航条,css,twitter-bootstrap-3,navbar,Css,Twitter Bootstrap 3,Navbar,我想让菜单栏在用户滚动时保持在顶部。我曾经使用Bootstrap的类“navbar fixed top”,它工作得很好 但用户希望在导航栏上方添加一些品牌和徽标。但他们不希望在用户滚动时这些徽标粘在顶部。他们只想把导航条贴在那些标志下面 我尝试使用“导航栏固定顶部”,但它出现在徽标上,而不是徽标下方 我的HTML: <div class="container"> <nav class="col-md-12 text-left"> // Code

我想让菜单栏在用户滚动时保持在顶部。我曾经使用Bootstrap的类“navbar fixed top”,它工作得很好

但用户希望在导航栏上方添加一些品牌和徽标。但他们不希望在用户滚动时这些徽标粘在顶部。他们只想把导航条贴在那些标志下面

我尝试使用“导航栏固定顶部”,但它出现在徽标上,而不是徽标下方

我的HTML:

<div class="container">
    <nav class="col-md-12 text-left">
        // Code for Logos and Images
    </nav>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
        <div class="navbar-header">

        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
            <li>.....</li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</nav>

//标识和图像代码

如何使导航条粘贴到顶部(而不是徽标)

首先将导航条固定顶部从导航标签上移除,并将此代码放入头部标签中

    <script>
        $(window).scroll(function() {
            var height = $(window).scrollTop();
            if(height  <= 100) {
                $("nav").addClass("navbar-fixed-top");
            }
            if(height  <= 10) {
                $("nav").removeClass("navbar-fixed-top");
            }
        });
    </script>

$(窗口)。滚动(函数(){
var height=$(window.scrollTop();
如果(可能的解决方案)