项目作者: sjoloughlin

项目描述 :
Simple jquery slideshow library. Lightweight, responsive, easy to implement & configure.
高级语言: JavaScript
项目地址: git://github.com/sjoloughlin/jquery-slideshow.git
创建时间: 2017-02-08T15:41:56Z
项目社区:https://github.com/sjoloughlin/jquery-slideshow

开源协议:MIT License

下载


jQuery Slideshow

Simple jQuery slideshow library. Lightweight, responsive, easy to implement & configure.

Standard - JavaScript Style Guide npm version

Demo

http://www.sjoloughlin.com/jquery-slideshow

Installation

Download

Get the latest release from the releases page and add the files to your project.

Link the stylesheet inside your <head> tag:

  1. <link rel="stylesheet" type="text/css" href="slider.min.css" />

Then, before your closing <body> tag add:

  1. <script type="text/javascript" src="slider.min.js"></script>

NPM

  1. npm install jquery-slideshow

Usage

Add the following HTML for the slider:

  1. <ul class="slider" id="slider">
  2. <li>
  3. <img src="images/slide1.jpg" alt="slide1"/>
  4. </li>
  5. <li>
  6. <img src="images/slide2.jpg" alt="slide2"/>
  7. </li>
  8. <li>
  9. <img src="images/slide3.jpg" alt="slide3"/>
  10. </li>
  11. </ul>

Then, before your closing <body> call .slider() on the slider element:

  1. <script type="text/javascript">
  2. $(window).on("load", function() {
  3. $("#slider").slider();
  4. });
  5. </script>

Configuration

The slider is configurable by passing in a configuration object when calling .slider() on the slider element:

  1. <script type="text/javascript">
  2. $(window).on("load", function() {
  3. $("#slider").slider({
  4. width : '1024px', // Width of the slider
  5. height : '500px', // Height of the slider
  6. speed : 2000, // How long the slide animation transition lasts for in millisecond
  7. delay : 5000 // How long the slide will be displayed for in milliseconds
  8. });
  9. });
  10. </script>

Options

Config Type Default Description
speed int 1000 How long the slide animation transition lasts for in milliseconds e.g. 1000 = 1 second
delay int 3000 How long the slide will be displayed for in milliseconds e.g. 3000 = 3 seconds
autoplay boolean true Whether to start the slideshow automatically
navigation boolean true Whether to display left/right navigation buttons
pagination boolean true Whether to display clickable slide indicators
paginationType string dots Pagination type to use. Options: ‘dots’, ‘thumbnails’
width string 100% Width of the slider
height string auto Height of the slider
direction string right The direction that the slider will slide
responsive boolean true Whether to make the size of the slider responsive

License

This project is licensed under the MIT License - see the LICENSE.md file for details.