Bootstrap daily learning responsive navigation rotation map
- 2021-02-17 06:15:19
- OfStack
In the first section before this class, we started to design the first project, a corporate website of an internal training company. In this class, we learned the part of responsive navigation.
Basic navigation components + responsive:
// Basic Navigation Components + responsive
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<a href="#" class="navbar-brand"
style="margin:0;padding:0;"><img src="img/logo.png" alt=" Diaocheng enterprise training network "></a>
<button type="button" class="navbar-toggle"
data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only"> Switch navigation </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav navbar-right"
style="margin-top:0;">
<li class="active">
<a href="#"><span class="glyphiconglyphicon-home"></span> Home page </a>
</li>
<li>
<a href="#"><span class="glyphicon
glyphicon-list"></span> information </a>
</li>
<li>
<a href="#"><span class="glyphicon
glyphicon-fire"></span> case </a>
</li>
<li>
<a href="#"><span class="glyphicon
glyphicon-question-sign"></span> about </a>
</li>
</ul>
</div>
</div>
</nav>
In the next section, we will make a rotating map at the bottom of the navigation bar to automatically play the latest important developments.
// Responsive rotation map
<div id="myCarousel" class="carousel slide">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0"
class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active" style="background:#223240;">
<a href="#"><img src="img/slide1.png" alt=" The first 1 zhang "></a>
</div>
<div class="item" style="background:#F5E4DC;">
<a href="#"><img src="img/slide2.png" alt=" The first 2 zhang "></a>
</div>
<div class="item" style="background:#DE2A2D;">
<a href="#"><img src="img/slide3.png" alt=" The first 3 zhang "></a>
</div>
</div>
<a href="#myCarousel" data-slide="prev" class="carousel-controlleft">‹</a>
<a href="#myCarousel" data-slide="next" class="carousel-controlright">›</a>
</div>
// The required jQuery control
$('#myCarousel').carousel({
// Set Auto Play /2 seconds
interval : 3000,
});
// Adjust the wheel-seeder arrow position
$('.carousel-control').css('line-height', $('.carousel-innerimg').height() + 'px');
$(window).resize(function() {
var $height = $('.carousel-inner img').eq(0).height() || $('.carousel-inner img').eq(1).height() || $('.carousel-inner img').eq(2).height();
$('.carousel-control').css('line-height', $height + 'px');
});
// The required CSS
a:focus {
outline: none;
}
.navbar-brand {
padding: 0;
}
#myCarousel {
margin: 50px 0 0 0;
}
.carousel-inner .item img {
margin: 0 auto;
}
.carousel-control {
font-size: 100px;
}
If you want to learn more, you can click here to learn more, and here are three wonderful topics for you:
Bootstrap tutorial
Bootstrap Practical Tutorial
The Bootstrap plugin uses the tutorial
The above is all the content of this article, I hope to help you learn Bootstrap programming.