gpt4 book ai didi

jquery - 创建仅在移动设备中的中型设备(平板电脑)bot 上显示的 Bootstrap 菜单汉堡包图标

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

我正在尝试使用 Bootstrap 创建导航菜单。

我有一个与 CodePen example. 非常相似的菜单

与每个普通导航栏一样工作

.navbar, .navbar-inverse {
border-radius: 0;
border: none;
margin-bottom: 0;
min-height: 80px;
}

.nav li {
display: inline;
color: white;
}

.navbar-inverse .navbar-nav > li > a {
color: #ffffff;
font-family: Lato;
font-size: 1.7em;
font-weight: 300;
padding: 30px 25px 33px 25px;
}

.navbar-inverse .navbar-nav li a:hover {
background-color: #444444;
transition: 0.7s all linear;
height: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!--/ Bootstrap -->
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container">
<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">
<ul class="nav navbar-nav">
<li><a href="index.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</div>
</nav>
</div>

但我希望在中型设备平板电脑和手机上显示汉堡包图标。

目前仅适用于手机。

让它发挥作用的最佳方法是什么?

最佳答案

根据 http://getbootstrap.com/css/#grid-media-queriesGerard 的评论使用媒体查询

Media queries

We use the following media queries in our Less files to create the key breakpoints in our grid system.

/* Extra small devices (phones, less than 768px) */
/* No media query since this is the default in Bootstrap */

/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) { ... }

/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md-min) { ... }

/* Large devices (large desktops, 1200px and up) */
@media (min-width: @screen-lg-min) { ... }

We occasionally expand on these media queries to include a max-width to limit CSS to a narrower set of devices.

@media (max-width: @screen-xs-max) { ... }
@media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { ... }
@media (min-width: @screen-md-min) and (max-width: @screen-md-max) { ... }
@media (min-width: @screen-lg-min) { ... }

关于jquery - 创建仅在移动设备中的中型设备(平板电脑)bot 上显示的 Bootstrap 菜单汉堡包图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44023980/

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