bootstrap中怎么設(shè)置輪播時(shí)間,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。
BootStrap輪播圖官方代碼:
<!--data-ride設(shè)置圖片切換方式為滑動(dòng) --><div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- 設(shè)置輪播圖的數(shù)量和順序--> <!--data-target的值應(yīng)與上面的id值對(duì)應(yīng) --> <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> <!-- 要展示的圖片信息 --> <div class="carousel-inner" role="listbox"> <div class="item active"> <img src="..." alt="..."> <div class="carousel-caption"> ... </div> </div> <div class="item"> <img src="..." alt="..."> <div class="carousel-caption"> ... </div> </div> ... </div> <!-- 控制圖標(biāo) --> <a class="left carousel-control" href="#carousel-example-generic" 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="#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>
實(shí)現(xiàn)輪播圖時(shí)間間隔改變的兩種方式:
1、在data-ride后面加上一個(gè)屬性data-interval=“millisecond”,其中,millisecond為需要設(shè)置的毫秒數(shù),如下:
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="1000">
使用JavaScript語(yǔ)句實(shí)現(xiàn):官網(wǎng)給出的代碼是:
$('.carousel').carousel({interval: 2000});
直接使用這個(gè)代碼無(wú)法實(shí)現(xiàn),應(yīng)在該方法前面加上一個(gè)函數(shù)表達(dá)式,如下:
$(function(){$('#carousel-example-generic').carousel({interval:1000});});
看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝您對(duì)創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,的支持。
網(wǎng)站欄目:bootstrap中怎么設(shè)置輪播時(shí)間-創(chuàng)新互聯(lián)
路徑分享:http://vcdvsql.cn/article18/jehgp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、網(wǎng)站設(shè)計(jì)、面包屑導(dǎo)航、外貿(mào)建站、靜態(tài)網(wǎng)站、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容