A simple jquery slide plugin (jquery-slider) based on JSON format data _jquery

Source: Internet
Author: User
Tags button type prev

Jquery-slider is a jquery slide plug-in based on JSON format data. This slide provides image address and description information through JSON data, and you can dynamically switch between different pictures by replacing the JSON data.

Online preview Source Download

How to use

Introduce jquery and slider.js files and Font-awesome font icon files to the page.

<link rel= ' stylesheet ' href= ' https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/ Font-awesome.min.css ' >
<script type= "Text/javascript" src= "Js/jquery.min.js" ></script>
<script type= "Text/javascript" src= "Js/slider.js" ></script>

HTML structure

Use a <div> as a container for slides, which are placed as <button> elements for the front and rear navigation buttons.

<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 Styles

Set the following CSS style for your slides.

. slider {width:100%; Overflow:hidden height:500px; position:relative;} sliderlist {position:absolute; top:0; w
idth:300%;
height:100%;
List-style:none; }. sliderlist Li {position:absolute; top:0; bottom:0; overflow:hidden; width:33.333333%; height:100%; padding:0; m.
argin:0; }. Sliderlist li img {width:100%; min-height:100% border:none;} bulletlist {position:absolute; bottom:15px; Widt
h:100%;
margin:0 Auto;
List-style:none; }. bulletlist li {display:inline-block; width:12px; height:12px; margin:0 5px;-webkit-border-radius:50%;-moz-borde
r-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; backg
Round-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-bo
X 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 data

The picture and picture descriptions for this slide are available in JSON data, in the following format:

Sliderjson = [
{"
ImagePath": "1.jpg",
"Order": "2",
"url": "#",
"Slidetext": "Picture description"
},
{
"ImagePath": "2.jpg", "Order
": "3",
"url": "#",
"Slidetext": "Picture description"
}, 
{
" ImagePath ": 3.jpg",
"Order": "1",
"url": "#",
"Slidetext": "Picture description"
},
{
"ImagePath": "4.jpg",
"Order": "4",
"url": "#",
"Slidetext": "Picture description"

The GitHub address for the Jquery-slider slide plugin is: Https://github.com/eryasov/jquery-slider

The above is a small set to introduce the JSON format data based on a simple jquery slide plugin (jquery-slider), I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.