gpt4 book ai didi

jquery - 导航栏下方的 Bootstrap 搜索栏

转载 作者:行者123 更新时间:2023-12-01 07:52:56 25 4
gpt4 key购买 nike

我有一个使用 Bootstrap 定义的导航栏,如下所示:

        <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="navbar-inner">
<div class="container">
<a class="brand pull-left" href="?route=home/dashboard"> Intranet <span class="sml_t">mx</span></a>
<ul id="mobile-nav" class="nav navbar-nav">
<li class="divider-vertical hidden-sm hidden-xs"></li>
<li>
<a href="?route=home/inquiry"><i class="icon-list-alt icon-white"></i> Inquiry</a>
</li>
<li>
<a href="?route=home/orders"><i class="icon-list-alt icon-white"></i> Orders</a>
</li>
<li>
<a href="?route=home/debts"><i class="icon-list-alt icon-white"></i> C&S Debts</a>
</li>
<li class="<?= $payroll;?>">
<a href="?route=home/payroll"><i class="icon-list-alt icon-white"></i> Payroll</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Settings<b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="<?= $admin;?>">
<a href="?route=home/users/settings/roles"><i class="icon-list-alt icon-white"></i> Roles</a>
</li>
<li class="<?= $admin;?>">
<a href="?route=home/dump"><i class="icon-list-alt icon-white"></i> Dump list</a>
</li>
<li class="<?= $events;?>">
<a href="?route=home/calendar"><i class="icon-list-alt icon-white"></i> Calendar schedule</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Catalog<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?route=home/partners">Partners</a></li>
<li class="<?= $products;?>"><a href="?route=home/products">Products</a></li>
<li class="<?= $categ;?>"><a href="?route=home/category">Categories</a></li>
<li class="divider"></li>
<li><a href="?route=home/offers">Offers</a></li>
</ul>
</li>
<li class="divider-vertical"></li>
</ul>

<div class="input-group clearfix" style="padding-top: 5px; width: 100px;">
<input type="text" class="form-control" placeholder="Search..." id="query" name="query" value="" />
<div class="input-group-btn">
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-search"></span></button>
</div>
</div>

<ul class="nav navbar-nav user_menu pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><img src="<?=DIR_MEDIA?>img/user_avatar.png" alt="" class="user_avatar"><?php echo $this->user->username;?><b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="?route=home/user_profile">Account settings</a></li>
<li class="<?= $admin;?>">
<a href="?route=home/settings">Sys Settings</a>
</li>
<li class="divider"></li>
<li><a href="?route=logout">Log Out</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>

仅当我在桌面模式下使用它时,这看起来不错,但在响应式布局中它会崩溃我希望在导航栏下方隐藏第二个栏,这是一个在单击触发器时激活的搜索栏,例如搜索按钮

有人可以通过这样的导航栏跟我说话吗?我尝试过这样的事情:

            <nav class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Sub menu</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-2">
<ul class="nav navbar-nav">
<li class="active">
<input type="text" class="form-control" placeholder="Search..." id="query1" name="query" value="" />
</li>

</ul>
</div><!-- /.navbar-collapse -->
</nav>

但是,第二个导航栏被第一个导航栏隐藏了..

有什么想法吗?

最佳答案

因为你的第一个导航栏有 .navbar-fixed-top 你可以设置一个 body { padding-top: 70px;在 CSS 代码中添加 } 以防止重叠,另请参阅 http://getbootstrap.com/components/#navbar-fixed-top :

The fixed navbar will overlay your other content, unless you add padding to the top of the . Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.

我还发现您的搜索框(包含在input-groupclearfix内)没有float: left(用于更大的屏幕宽度),这会破坏您的第一个搜索框导航栏分成两行。在其他情况下,导航栏也会分成两行:Disable Bootstrap 3 navbar going 2 rows in medium viewport size

最后你还应该阅读:Multiple navbars on the same page with Twitter's Bootstrap 3

关于jquery - 导航栏下方的 Bootstrap 搜索栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27462051/

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