Bootstrap輪播圖的使用和理解4
本文實(shí)例為大家分享了Bootstrap輪播圖的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Bootstrap 模板</title> <link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <style> img { width: 100%; height: 100%; } p { text-align: center; } </style> </head> <body> <!-- 輪播圖部分 --> <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <!-- 指示器 --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> <li data-target="#carousel-example-generic" data-slide-to="1"></li> <li data-target="#carousel-example-generic" data-slide-to="2"></li> </ol> <!-- Wrapper for slides --> <!-- 包裹幻燈片 --> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="images/輪播1.png" alt="輪播圖1"> <div class="carousel-caption"> 輪播圖1 </div> </div> <div class="item"> <img src="images/輪播2.png" alt="輪播圖2"> <div class="carousel-caption"> 輪播圖2 </div> </div> <div class="item"> <img src="images/輪播3.png" alt="輪播圖3"> <div class="carousel-caption"> 輪播圖3 </div> </div> <p>輪播圖嘗試</p> </div> <!-- Controls --> <!-- 控制 --> <!-- 向左滑動(dòng) --> <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="false"></span> <span class="sr-only">Previous</span> </a> <!-- 向右滑動(dòng) --> <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <!-- js控制輪播圖 --> <button id="prev">向前</button> <button id="next">向后</button> <button id="pause">停止</button> <button id="start">開(kāi)始</button> <button id="jump">到第二張</button> <script src="lib/jquery/jquery.js"></script> <script src="lib/bootstrap/js/bootstrap.js"></script> <!-- 輪播圖還支持js控制 --> <script> $(function(){ $('.carousel').carousel({ interval: 2000,//輪播間隔 pause:"hover", //鼠標(biāo)懸停在輪播圖上,是否停止?jié)L動(dòng) wrap:true, // keyboard:true //響應(yīng)鍵盤(pán)事件 }); $("#prev").click(function(event) { $('.carousel').carousel('prev')// 周期上一個(gè)項(xiàng)目。 }); $("#next").click(function(event) { $('.carousel').carousel('next')// 周期到下一個(gè)項(xiàng)目。 });; $("#pause").click(function(event) { $('.carousel').carousel('pause')// 從通過(guò)項(xiàng)目循環(huán)停止傳送帶。 });; $("#start").click(function(event) { $('.carousel').carousel('cycle')// 通過(guò)傳送帶項(xiàng)目周期從左到右。 });; $("#jump").click(function(event) { $('.carousel').carousel(1)// 循環(huán)傳送帶到一個(gè)特定的幀(0為主,類(lèi)似于數(shù)組)。 });; }); </script> </body> </html>
如果大家還想深入學(xué)習(xí),可以點(diǎn)擊這里進(jìn)行學(xué)習(xí),再為大家附3個(gè)精彩的專(zhuān)題:
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 利用BootStrap的Carousel.js實(shí)現(xiàn)輪播圖動(dòng)畫(huà)效果
- 使用BootStrap進(jìn)行輪播圖的制作
- BootStrap實(shí)現(xiàn)輪播圖效果(收藏)
- 使用BootStrap建立響應(yīng)式網(wǎng)頁(yè)——通欄輪播圖(carousel)
- Bootstrap幻燈片輪播圖支持觸屏左右手勢(shì)滑動(dòng)的實(shí)現(xiàn)方法
- BootStrap實(shí)現(xiàn)手機(jī)端輪播圖左右滑動(dòng)事件
- 通過(guò)BootStrap實(shí)現(xiàn)輪播圖的實(shí)際應(yīng)用
- Bootstrap開(kāi)發(fā)實(shí)戰(zhàn)之響應(yīng)式輪播圖
- Bootstrap每天必學(xué)之響應(yīng)式導(dǎo)航、輪播圖
- Bootstrap實(shí)現(xiàn)基于carousel.js框架的輪播圖效果
相關(guān)文章
簡(jiǎn)單了解JavaScript arguement原理及作用
這篇文章主要介紹了簡(jiǎn)單了解JavaScript arguement原理及作用,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05JS實(shí)現(xiàn)仿中關(guān)村論壇評(píng)分后彈出提示效果的方法
這篇文章主要介紹了JS實(shí)現(xiàn)仿中關(guān)村論壇評(píng)分后彈出提示效果的方法,實(shí)例分析了javascript彈出特效的css與提示框的具體實(shí)現(xiàn)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-02-02用函數(shù)模板,寫(xiě)一個(gè)簡(jiǎn)單高效的 JSON 查詢(xún)器的方法介紹
本篇文章小編將為大家介紹,用函數(shù)模板,寫(xiě)一個(gè)簡(jiǎn)單高效的 JSON 查詢(xún)器的方法介紹,需要的朋友可以參考一下2013-04-04js實(shí)現(xiàn)頂部可折疊的菜單工具欄效果實(shí)例
這篇文章主要介紹了js實(shí)現(xiàn)頂部可折疊的菜單工具欄效果,可實(shí)現(xiàn)鼠標(biāo)滑過(guò)菜單工具欄出現(xiàn)折疊與展開(kāi)效果,涉及javascript鼠標(biāo)事件及樣式的操作技巧,需要的朋友可以參考下2015-05-05js實(shí)現(xiàn)接收表單的值并將值拼在表單action后面的方法
這篇文章主要介紹了js實(shí)現(xiàn)接收表單的值并將值拼在表單action后面的方法,涉及JavaScript動(dòng)態(tài)操作字符串及表單元素的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-11-11js使用文檔就緒函數(shù)動(dòng)態(tài)改變頁(yè)面內(nèi)容示例【innerHTML、innerText】
這篇文章主要介紹了js使用文檔就緒函數(shù)動(dòng)態(tài)改變頁(yè)面內(nèi)容,結(jié)合實(shí)例形式分析了JavaScript使用innerHTML、innerText函數(shù)動(dòng)態(tài)操作頁(yè)面元素相關(guān)使用技巧,需要的朋友可以參考下2019-11-11