亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

基于JSON格式數(shù)據(jù)的簡(jiǎn)單jQuery幻燈片插件(jquery-slider)

 更新時(shí)間:2016年08月10日 15:13:39   作者:愛(ài)上程序猿  
jquery-slider幻燈片插件通過(guò)json數(shù)據(jù)來(lái)提供圖片地址和描述信息,同時(shí)也可以更換json數(shù)據(jù)來(lái)動(dòng)態(tài)切換不同的圖片,對(duì)json數(shù)據(jù)jquery幻燈片插件相關(guān)知識(shí)感興趣的朋友一起學(xué)習(xí)吧

jquery-slider是一款基于JSON格式數(shù)據(jù)的jQuery幻燈片插件。該幻燈片通過(guò)JSON數(shù)據(jù)來(lái)提供圖片地址和描述信息等,你可以通過(guò)更換JSON數(shù)據(jù)來(lái)動(dòng)態(tài)切換不同的圖片。

在線預(yù)覽     源碼下載

使用方法

在頁(yè)面中引入jquery和slider.js文件和font-awesome字體圖標(biāo)文件。

<link rel='stylesheet' >
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/slider.js"></script>

HTML結(jié)構(gòu)

使用一個(gè)<div>作為幻燈片的容器,里面放置作為前后導(dǎo)航按鈕的<button>元素。

<div class="slider" id="slider">
<button type="button" class="button button-prev">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
</button>
<button type="button" class="button button-next">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</button>
</div>

CSS樣式

為幻燈片設(shè)置下面的CSS樣式。

.slider {
width: 100%;
overflow: hidden;
height: 500px;
position: relative;
}
.sliderList {
position: absolute;
top: 0;
width: 300%;
height: 100%;
list-style: none;
}
.sliderList li {
position: absolute;
top: 0;
bottom: 0;
overflow: hidden;
width: 33.333333%;
height: 100%;
padding: 0;
margin: 0;
}
.sliderList li img {
width: 100%;
min-height: 100%;
border: none;
}
.bulletList {
position: absolute;
bottom: 15px;
width: 100%;
margin: 0 auto;
list-style: none;
}
.bulletList li {
display: inline-block;
width: 12px;
height: 12px;
margin: 0 5px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-ms-border-radius: 50%;
border-radius: 50%;
background-color: #fff;
cursor: pointer;
}
.bulletList .bulletActive { background-color: #0b0d18; }
.content {
position: absolute;
top: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.3);
font-size: 48px;
color: #fff;
}
.button {
position: absolute;
bottom: 15px;
z-index: 2;
display: block;
width: 40px;
height: 40px;
box-sizing: border-box;
margin: 0;
padding: 0;
border: none;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px;
background-color: rgba(5, 0, 36, 0.6);
color: #fff;
}
.button-prev { left: 15px; }
.button-next { right: 15px; }

JSON數(shù)據(jù)

該幻燈片的圖片和圖片描述信息有JSON數(shù)據(jù)來(lái)提供,格式如下:

sliderJSON = [
{
"imagePath": "1.jpg",
"order": "2",
"url": "#",
"slideText": "圖片描述"
},
{
"imagePath": "2.jpg",
"order": "3",
"url": "#",
"slideText": "圖片描述"
}, 
{
"imagePath": "3.jpg",
"order": "1",
"url": "#",
"slideText": "圖片描述"
},
{
"imagePath": "4.jpg",
"order": "4",
"url": "#",
"slideText": "圖片描述"
} 

jquery-slider幻燈片插件的github地址為:https://github.com/eryasov/jquery-slider

以上所述是小編給大家介紹的基于JSON格式數(shù)據(jù)的簡(jiǎn)單jQuery幻燈片插件(jquery-slider),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論