PgwJS
Powered by Pagawa.com

PgwSlideshow - Responsive slideshow / gallery / carousel for jQuery / Zepto

Download

Current version: 2.0
To download or fork this project, please visit our GitHub repository
And of course, you will need Jquery or Zepto to use this responsive carousel plugin.
jquery zepto.js

Example

You can test our slideshow plugin, by resizing your browser and/or configuring some options, and see the result below:
 Slideshow style:
 Transition effect:
 Display options:
To see all available gallery options, click here.
  • San Francisco, USA
  • Rio de Janeiro, Brazil
  • Monaco
HTML:
<ul class="pgwSlideshow">
    <li><img src="san-francisco.jpg" alt="San Francisco, USA" data-description="Golden Gate Bridge"></li>
    <li><img src="rio.jpg" alt="Rio de Janeiro, Brazil"></li>
    <li><img src="london_mini.jpg" alt="" data-large-src="london.jpg"></li>
    <li><img src="new-york.jpg" alt=""></li>
    <li><img src="new-delhi.jpg" alt=""></li>
    <li><img src="paris.jpg" alt=""></li>
    <li><img src="sydney.jpg" alt=""></li>
    <li><img src="tokyo.jpg" alt=""></li>
    <li><img src="honk-kong.jpg" alt=""></li>
    <li><img src="dakar.jpg" alt=""></li>
    <li><img src="toronto.jpg" alt=""></li>
    <li>
        <a href="http://en.wikipedia.org/wiki/Monaco" target="_blank">
            <img src="monaco.jpg" alt="Monaco">
        </a>
    </li>
</ul>
JavaScript:
$(document).ready(function() {
    $('.pgwSlideshow').pgwSlideshow();
});

Documentation

Gallery components

The statement of the carousel elements is defined via a HTML tag "<ul>" (see the example above).
You can add one or more slideshows on a same page.
Image
Each element must be placed in a <li> tag. By default, the image will be used in the list and to display the current element.
alt - This parameter defines the image title, it is used to display a caption on the image when it is selected. (See the first image in our example)
data-description - This parameter adds a new text line in the caption of the selected element. (See the first element in the example)
data-large-src - If you want to load a small image in the list, and a bigger when this image will be selected, you can add a "data-large-src" parameter to your <image> tag. (See the third image in the example)
Link
If you wish, you can create a link on your image by wrapping the <img> tag with a <a> tag (with or without "target" parameter). This link only appears on the container of the selected image, not in the list. (See the last image in the previous example)

Carousel plugin options

These options can be added during the initialization of the slider to customize it.
Option name Type Default Description
mainClassName String
'pgwSlideshow'
This option overrides the default CSS class of the slideshow.
transitionEffect String
'sliding'
2 transition effects are available: "sliding" or "fading".
autoSlide Boolean
false
Enable or disable the automatic transition between the gallery images.
beforeSlide Function
false
This option may contain a function that will be called before each new slide. For example:
"function(id) { console.log('Before sliding - The current slide is ' + id); }"
afterSlide Function
false
In the same way as beforeSlide, the function afterSlide can be called after each slide. For example:
"function(id) { console.log('After sliding - The current slide is ' + id); }"
displayList Boolean
true
This option displays or not the list of the carousel elements.
displayControls Boolean
true
On the main container, this parameter sets a button on each side to display the previous or next image.
touchControls Boolean
true
If this option is activated, the main container binds the touch movements and displays the previous or next slide. (Only the mobile devices send these events)
maxHeight Integer
null
If you want to set a maximum height to your slideshow, you can set this option with a number in pixels (without the suffix "px").
adaptiveDuration Integer
200
This duration is the period in milliseconds, during the adjustment of the previous option runs (if it is activated).
transitionDuration Integer
500
Period of animation in milliseconds between 2 images.
intervalDuration Integer
3000
Interval in milliseconds before displaying of the next image. This option requires "autoSlide" option activated.

Slideshow API

To use these gallery API functions, you must assign the initialization to a variable.
var pgwSlideshow = $('.pgwSlideshow').pgwSlideshow();
startSlide - Enables the automatic sliding function.
pgwSlideshow.startSlide();
stopSlide - Disables the automatic sliding function.
pgwSlideshow.stopSlide();
getCurrentSlide - Returns the current image number.
pgwSlideshow.getCurrentSlide();
getSlideCount - Returns the total number of the gallery elements.
pgwSlideshow.getSlideCount();
displaySlide - Displays the image selected by its number.
pgwSlideshow.displaySlide(3);
nextSlide - Displays the next image.
pgwSlideshow.nextSlide()
previousSlide - Displays the previous image.
pgwSlideshow.previousSlide();
destroy - Destroys the carousel. If a parameter "true" is passed, the container will be only hidden for a possible reloading.
pgwSlideshow.destroy();
reload - Reloads the slideshow with new options of configuration. For example:
pgwSlideshow.reload({
    transitionEffect : 'fading',
    adaptiveDuration : 4000
});
jquery / zepto responsive slider - jquery / zepto responsive menu - jquery / zepto responsive modal / dialog - jquery / zepto cookie plugin