gpt4 book ai didi

javascript - 修复后如何在滚动条上居中 Bootstrap navbar-nav?

转载 作者:太空宇宙 更新时间:2023-11-04 03:05:41 25 4
gpt4 key购买 nike

我有一个数据属性 data-spy="affix"data-offset-top="60"data-offset-bottom="200",所以当滚动时它的位置是固定的。但它将它移到左边。我怎样才能让它居中。这是运行中的代码 http://leoroofingconstruction.com

<nav class="navbar navbar-default baraNav" >
<div class="container-fluid">
<h1 class="logo">Las Fiestas</h1>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1" data-spy="affix" data-offset-top="60" data-offset-bottom="200">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Our Specialties <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
<li class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul>
</li>
<li><a href="#">Our Menu</a></li>
<li><a href="#">Events</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

CSS:

@import url(http://fonts.googleapis.com/css?family=Tangerine);
@import url(http://fonts.googleapis.com/css?family=Exo+2:300);


.carousel-control.left, .right{
display: none;
}
.sliderIntro{
font-family: 'Tangerine', cursive;
font-size: 70px;
}

.pIntro{
font-size: 15px;
font-family: 'Exo 2', sans-serif;
}
.Me{
font-size: 15px;
font-family: 'Exo 2', sans-serif;
color: #2ebc58;
}
.xi{
font-size: 15px;
font-family: 'Exo 2', sans-serif;
color: #ffffff;
}
.can{
font-size: 15px;
font-family: 'Exo 2', sans-serif;
color: #ff0000;
}


.logo{
font-family: 'Tangerine', cursive;
font-size: 100px;
text-align: center;
color:#ffffff;
}

.baraNav{
margin-top: -730px;
}

.navbar .navbar-nav {
display: inline-block;
float: none;
}

.navbar .navbar-collapse {
text-align: center;
}

最佳答案

必要的添加.affix - width 100%

关于javascript - 修复后如何在滚动条上居中 Bootstrap navbar-nav?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30510752/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com