gpt4 book ai didi

javascript - 引导导航栏响应不工作

转载 作者:行者123 更新时间:2023-11-28 05:33:06 25 4
gpt4 key购买 nike

在全窗口屏幕上,我的导航栏完全符合我的要求。但是一旦我将窗口变小以检查它是否有响应,我就没有一个接一个地获得所有菜单按钮(主页、技能、关于我们、联系方式)和其次,当我将窗口屏幕调整回全屏时,导航栏变小。

<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags always come first -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" integrity="sha384-y3tfxAZXuh4HwSYylfB+J125MxIs6mR5FOHamPBG064zB+AFeWH94NdvaCBm8qnd" crossorigin="anonymous">

<style type="text/css">

#navbar .nav-pills .nav-item.open .nav-link,
#navbar .nav-pills .nav-item.open .nav-link:focus,
#navbar .nav-pills .nav-item.open .nav-link:hover,
#navbar .nav-pills .nav-link.active,
#navbar .nav-pills .nav-link.active:focus,
#navbar .nav-pills .nav-link.active:hover
{
background-color: #e7e7e7;
border-color: transparent;
color: #555555;
}

.navbar-default
{
background-color: #610B0B ;
border-radius:0px;

}

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

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

.navbar-default .navbar-nav > li > a
{
color: white;
font-size: 15px;
font-family: 'Droid Serif', Georgia, Times, serif;
letter-spacing: 1px;
margin: 3px 10px -3px 10px;
border: 2px solid transparent;
padding: 8px;

}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus
{
border: 2px solid white;
border-radius: 5px;
color: white;
padding: 8px;
}

.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus
{
border: 2px solid white;
border-radius: 5px;
color: #555;
background-color: #E7E7E7;
}

.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus
{
color: #555;
background-color: #D5D5D5;
}

</style>

</head>
<body data-spy="scroll" data-target="#navbar">

<div id="navbar">

<nav class="navbar navbar-default center navbar-fixed-top" id="navbar">

<button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2">&#9776;</button>

<div class="collapse navbar-toggleable-xs" id="exCollapsingNavbar2">

<a class="navbar-brand" href="#"></a>

<div class="navbar-inner">

<ul class="nav navbar-nav nav-pills">

<li class="nav-item">
<a class="nav-link active" href="#jumbotron">HOME <span class="sr-only">(current)</span></a>
</li>

<li class="nav-item">
<a class="nav-link" href="#about">ABOUT</a>
</li>

<li class="nav-item">
<a class="nav-link" href="#skills">SKILLS</a>
</li>

<li class="nav-item">
<a class="nav-link" href="#contact">CONTACT</a>
</li>

</ul>

</div>

</div>

</nav>
</div>
</body>

<!-- jQuery first, then Bootstrap JS. -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js" integrity="sha384-vZ2WRJMwsjRMW/8U7i6PWi6AlO1L79snBrmgiDpgIWJ82z8eA5lenwvxbMV1PAh7" crossorigin="anonymous"></script>
</body>
</html>

最佳答案

请添加bootstrap css和js的引用。

#navbar .nav-pills .nav-item.open .nav-link,
#navbar .nav-pills .nav-item.open .nav-link:focus,
#navbar .nav-pills .nav-item.open .nav-link:hover,
#navbar .nav-pills .nav-link.active,
#navbar .nav-pills .nav-link.active:focus,
#navbar .nav-pills .nav-link.active:hover
{
background-color: #e7e7e7;
border-color: transparent;
color: #555555;
}

.navbar-default
{
background-color: #610B0B ;
border-radius:0px;

}

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

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

.navbar-default .navbar-nav > li > a
{
color: white;
font-size: 15px;
font-family: 'Droid Serif', Georgia, Times, serif;
letter-spacing: 1px;
margin: 3px 10px -3px 10px;
border: 2px solid transparent;
padding: 8px;

}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus
{
border: 2px solid white;
border-radius: 5px;
color: white;
padding: 8px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<body data-spy="scroll" data-target="#navbar">

<div id="navbar">

<nav class="navbar navbar-default center navbar-fixed-top" id="navbar">

<button class="navbar-toggler hidden-sm-up" type="button" data-toggle="collapse" data-target="#exCollapsingNavbar2">&#9776;</button>

<div class="collapse navbar-toggleable-xs" id="exCollapsingNavbar2">

<a class="navbar-brand" href="#"></a>

<div class="navbar-inner">

<ul class="nav navbar-nav nav-pills">

<li class="nav-item">
<a class="nav-link active" href="#jumbotron">HOME <span class="sr-only">(current)</span></a>
</li>

<li class="nav-item">
<a class="nav-link" href="#about">ABOUT</a>
</li>

<li class="nav-item">
<a class="nav-link" href="#skills">SKILLS</a>
</li>

<li class="nav-item">
<a class="nav-link" href="#contact">CONTACT</a>
</li>

</ul>

</div>

</div>

</nav>
</div>
</body>

关于javascript - 引导导航栏响应不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38389232/

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