Basic Responsive Image Carousel Plugin With jQuery - Sunslide

File Size: 9.6 KB
Views Total: 1520
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Basic Responsive Image Carousel Plugin With jQuery - Sunslide

Sunslide is a simple, lightweight jQuery plugin used for creating a responsive, automatic, cross-fading image carouse/slideshow. The plugin has the ability to dynamically adjust the size of your images based on the minimalist, maximum or first (first image) aspect ratio.

More features:

  • Auto pause on hover.
  • Custom text for navigation buttons.
  • Image caption bar.
  • Play and Pause buttons.
  • Fully accessible.

How to use it:

1. Load jQuery library and the jQuery Sunslide pluing's files as usual.

<link href="jquery.sunslide.css" rel="stylesheet">
<script src="//code.jquery.com/jquery.min.js"></script>
<script src="jquery.sunslide.js"></script>

2. Create a list of images for the carousel. The plugin will automatically generate a caption bar containing image descriptions specified in the 'alt' attribute.

<ul class="sunslide">
  <li><img src="1.jpg" alt="Caption 1"></li>
  <li><img src="2.jpg" alt="Caption 2"></li>
  <li><img src="3.jpg" alt="Caption 3"></li>
  ...
</ul>

3. Call the sunslide function on the top element and done.

$('.sunslide').sunslide();

4. Full plugin options with default values.

$('.sunslide').sunslide({

  // auto play
  "auto": true,

  // shows captions
  "captions": true, 

  // shows navigation
  "nav": true,

  // text for next button
  "nextText": "&rarr;",   

  // pause on hover
  "pause": true,

  // shows 'Play' and 'Pause' buttons
  "play": true, 

  // text for previous button
  "prevText": "&larr;", 

  // Size to 'min', 'max', or 'first' (first slide) ratio
  "ratio": "first", 

  // stops autoplay when naivgate between slides
  "stopOnNav": true, 

  // time between transitions
  "timeout": 5000 
  
});

Change log:

2017-11-02

  • fix aspect ratio calc on images not yet loaded; add support for SVG instead of IMG; add aria-live support

2016-07-22

  • fix aspect ratio calc on images not yet loaded; add support for SVG instead of IMG; add aria-live support

This awesome jQuery plugin is developed by sunnywalker. For more Advanced Usages, please check the demo page or visit the official website.