Bootstrap學習筆記 輪播(Carousel)插件
Bootstrap 輪播(Carousel)插件是一種靈活的響應式的向站點添加滑塊的方式。除此之外,內(nèi)容也是足夠靈活的,可以是圖像、內(nèi)嵌框架、視頻或者其他您想要放置的任何類型的內(nèi)容。如果您想要單獨引用該插件的功能,那么您需要引用 carousel.js,或者bootstrap.js 或壓縮版的 bootstrap.min.js。
<!DOCTYPE html> <html> <head> <title>Bootstrap 輪播(Carousel)插件</title> <meta charset="utf-8"> <link rel="stylesheet" href="css/bootstrap.min.css" rel="external nofollow" > <link rel="stylesheet" href="css/carousel.css" rel="external nofollow" > <script src="js/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> </head> <body> <!-- Carousel ================================================== --> <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <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" role="listbox"> <div class="item active"> <img class="first-slide" src="http://localhost:8020/BootStrap/img/slide1.png" alt="First slide"> <div class="container"> <div class="carousel-caption"> <h1>Example headline.</h1> <p> Note: If you're viewing this page via a <code> file://</code> URL, the "next" and "previous" Glyphicon buttons on the left and right might not load/display properly due to web browser security rules. </p> <p> <a class="btn btn-lg btn-primary" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" role="button">Sign up today</a> </p> </div> </div> </div> <div class="item"> <img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide"> <div class="container"> <div class="carousel-caption"> <h1>Another example headline.</h1> <p> Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. </p> <p> <a class="btn btn-lg btn-primary" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" role="button">Learn more</a> </p> </div> </div> </div> <div class="item"> <img class="third-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Third slide"> <div class="container"> <div class="carousel-caption"> <h1>One more for good measure.</h1> <p> Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit. </p> <p> <a class="btn btn-lg btn-primary" href="#" rel="external nofollow" rel="external nofollow" rel="external nofollow" role="button">Browse gallery</a> </p> </div> </div> </div> </div> <!--左前進右后退--> <a class="left carousel-control" href="#myCarousel" rel="external nofollow" rel="external nofollow" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#myCarousel" rel="external nofollow" rel="external nofollow" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <!-- /.carousel --> </body> </html>
注意:
<img class="second-slide" src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" alt="Second slide">
data格式的Url最直接的好處是,這些Url原本會引起一個新的網(wǎng)絡訪問,因為那里是一個網(wǎng)頁的地址,現(xiàn)在不會有新的網(wǎng)絡訪問了,因為現(xiàn)在這里是網(wǎng)頁的內(nèi)容。這樣做,會減少服務器的負載,當然同時也增加了當前網(wǎng)頁的大小。所以對“小”數(shù)據(jù)特別有好處。
效果圖
bootstrap組件專題大家可以參考下:
http://www.dbjr.com.cn/Special/708.htm
以上所述是小編給大家介紹的Bootstrap學習筆記 輪播(Carousel)插件,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- Bootstrap 輪播(Carousel)插件
- 使用BootStrap建立響應式網(wǎng)頁——通欄輪播圖(carousel)
- 利用BootStrap的Carousel.js實現(xiàn)輪播圖動畫效果
- BootStrap框架個人總結(bootstrap框架、導航條、下拉菜單、輪播廣告carousel、柵格系統(tǒng)布局、標簽頁tabs、模態(tài)框、菜單定位)
- Bootstrap圖片輪播組件Carousel使用方法詳解
- BootStrap 輪播插件(carousel)支持左右手勢滑動的方法(三種)
- 全面解析Bootstrap中Carousel輪播的使用方法
- Bootstrap每天必學之輪播(Carousel)插件
相關文章
JavaScript實現(xiàn)一個多少秒后自動跳轉的頁面(案例代碼)
最近遇到這樣一個需求是用js簡單實現(xiàn)一個多少秒后自動跳轉的頁面,實現(xiàn)代碼非常簡單,對js自動跳轉頁面相關知識感興趣的朋友一起看看吧2023-01-01Javascript中的回調(diào)函數(shù)和匿名函數(shù)的回調(diào)示例介紹
這篇文章主要介紹了Javascript中的回調(diào)函數(shù)和匿名函數(shù)的回調(diào),需要的朋友可以參考下2014-05-05Spring Boot+AngularJS+BootStrap實現(xiàn)進度條示例代碼
一般上傳文件時都需要進度條,本篇文章主要介紹了Spring Boot+AngularJS+BootStrap實現(xiàn)進度條示例代碼,有興趣的可以了解一下。2017-03-03