国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

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

2019-11-20 09:15:55
字體:
供稿:網(wǎng)友

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

在線預(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)

使用一個<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ù)來提供,格式如下:

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ù)的簡單jQuery幻燈片插件(jquery-slider),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 阳东县| 尼勒克县| 东台市| 福建省| 佛山市| 体育| 萨迦县| 苍山县| 化隆| 二连浩特市| 获嘉县| 来凤县| 大余县| 璧山县| 星座| 厦门市| 肥西县| 上虞市| 如皋市| 牙克石市| 三河市| 宣武区| 兴安县| 黄平县| 临夏市| 缙云县| 望城县| 远安县| 丹东市| 广南县| 大港区| 尚志市| 上高县| 龙陵县| 玉溪市| 双峰县| 汾西县| 宜城市| 隆回县| 策勒县| 辽阳县|