In the previous section of this class, we began to design the first project, an internal training company's corporate website, and this class learns the responsive navigation part.
Basic navigation components + responsive:
//Basic navigation components + responsiveness<nav> <div> <a href="#" style="margin:0;padding:0;"><img src="img/logo.png"></a> <button type="button" data-toggle="collapse" data-target="#navbar-collapse"> <span>Switch navigation</span> <span></span> <span></span> </button> </div> <div id="navbar-collapse"> <ul style="margin-top:0;"> <li> <a href="#"><span></span> Home</a> </li> <li> <a href="#"><span></span> Information</a> </li> <li> <a href="#"><span></span> Case</a> </li> <li> <a href="#"><span></span> About</a> </li> </ul> </div> </div></nav>
In the next section, we will make a carousel picture below the navigation bar to automatically play the latest important news.
//Responsive carousel diagram<div id="myCarousel"> <ol> <li data-target="#myCarousel" data-slide-to="0"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <div> <div style="background:#223240;"> <a href="#"><img src="img/slide1.png"></a> </div> <div style="background:#F5E4DC;"> <a href="#"><img src="img/slide2.png"></a> </div> <div style="background:#DE2A2D;"> <a href="#"><img src="img/slide3.png"></a> </div> </div> <a href="#myCarousel" data-slide="prev">‹</a> <a href="#myCarousel" data-slide="next">›</a></div>
//The required jQuery control $('#myCarousel').carousel({ //Set autoplay/2 seconds interval: 3000,}); //Adjust the carousel 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(1).height() || $('.carousel-inner img').eq(2).height(); $('.carousel-control').css('line-height', $height + 'px');}); //Required CSSa: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 still want to study in depth, you can click here to study and attach 3 exciting topics to you:
Bootstrap learning tutorial
Bootstrap practical tutorial
Bootstrap plug-in usage tutorial
The above is all about this article, and I hope it will be helpful for everyone to learn Bootstrap programming.