我在小屏幕上遇到问题而我无法理解为什么会出现这种情况。
以下是演示:https://jsfiddle.net/7ww6ybpk/
以下是代码:
<!-- main navigation -->
<nav class="navbar navbar-toggleable-md navbar-light">
<div class="container">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#mainNav" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="">
<img class="img-fluid" src="https://twocan.co/public/images/shared/logos/logo-header.png" alt="Learn English with twocan.com" />
</a>
<div class="collapse navbar-collapse" id="mainNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="">
<i class="fa fa-home" aria-hidden="true"></i>
Foo
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">
<i class="fa fa-certificate"></i>
Foo
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="">
<i class="fa fa-lightbulb-o"></i>
Foo
</a>
</li>
</ul>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="">
<i class="fa fa-sign-in"></i>
Foo
</a>
</li>
<span class="navbar-text">
/
</span>
<li class="nav-item">
<a class="nav-link" href="">
Foo
<i class="fa fa-check"></i>
</a>
</li>
</ul>
</div>
</div>
</nav>
<!-- end main navigation -->
因为你可以看到汉堡菜单下面的标识......我该如何解决这个问题?
答案 0 :(得分:2)
尝试以下代码。我在导航栏中指定了右侧元素,当它崩溃时,所有内容都汇集在一起。我希望这是你正在寻找的东西。
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">
<img class="img-fluid" src="https://twocan.co/public/images/shared/logos/logo-header.png" alt="Learn English with twocan.com" /></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Foo</a></li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Foo Drop<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Foo 1 </a></li>
<li><a href="#">Foo 2</a></li>
<li><a href="#">Foo 3</a></li>
</ul>
</li>
<li><a href="#">Foo</a></li>
<li><a href="#">Foo</a></li>
</ul>
<!--Right Side-->
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Foo R1 </a></li>
<li><a href="#">Foo R2</a></li>
</ul>
</div>
</div>
</nav>`enter code here`
答案 1 :(得分:1)
不要在导航中嵌套// function to post items to the server
function postItems (options, items, done) {
items.forEach(function (item, index, items) {
var lastItemIndex = items.length - 1
$.post(options.url, {
ouch: option.ouch,
password: option.password,
order_id: option.currentOrderId,
widget_id: item[0],
number: item[1],
pence_price: item[2]
}, function (data) {
if (index < lastItemIndex) return;
return done($.parseJSON(data));
});
})
}
// usage
postItems({url: "/serverUrl", ouch:'someString', password: 'itsASecret'}, ["item", "collection", "goes", "here"], function(data){
alert(data.message);
});
。如果需要,您可以在那里使用.container
。
你的自定义CSS是嵌套的 - 除非你使用允许嵌套的预处理器,否则CSS不能正常工作。
.container-fluid
.navbar {
border-bottom: 1px solid #eeeeee;
}
.nav-link {
font-weight: 800;
}
.nav-item.active .nav-link {
color: #7cd97c !important;
}