Powered by

PgwSlider - Responsive slider for jQuery / Zepto


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


To test the adaptive slider, just resize your browser and/or configure some options, and see the result below:
 Transition effect:
 Selection mode:
 Display options:
To see all available options, click here.
<ul class="pgwSlider">
    <li><img src="paris.jpg" alt="Paris, France" data-description="Eiffel Tower and Champ de Mars"></li>
    <li><img src="montreal_mini.jpg" alt="Montréal, QC, Canada" data-large-src="montreal.jpg"></li>
        <img src="shanghai.jpg">
        <span>Shanghai, China</span>
        <a href="" target="_blank">
            <img src="new-york.jpg">
	    <span>New York, NY, USA</span>
$(document).ready(function() {


Slide components

This plugin is SEO compliant, so the statement of the slideshow elements is only via a HTML tag "<ul>" (see our example above).
If you wish, you can add one or more sliders on a same page.
Each image must be placed in a <li> tag. By default, this 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. (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 image in our 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 second image in our example)
To display a caption on the image, you can use the "alt" parameter on the <image> tag, but for SEO reasons, you might want to write the title out of this tag. For this, create a new <span> tag containing your title, in the same <li> tag. (See the third image in our example)
If you want to create a link on your image, you can wrap the code contained in the <li> tag with a <a> tag (with or without a "target" parameter). The link will only appear on the main side, not in the list. (See the fourth image in our example)

Plugin options

You can add these options during the slider initialization to customize it.
Option name Type Default Description
mainClassName String
This option overrides the default CSS class of the slider.
listPosition String
To choose the position of the list, you can set this option to "left" or "right". If you want to disable the displaying of the list, see the option "displayList".
selectionMode String
This option sets the selection mode of the current element, it can be set to "click" or "mouseOver". "mouveOver" is only active with the transition effect "fading".
transitionEffect String
You can choose between 2 different transition effects: "fading" or "sliding".
autoSlide Boolean
Enable or disable the automatic transition between the images of the slider.
displayList Boolean
This option displays or not the list of the slider elements. To choose the position, see the option "listPosition".
displayControls Boolean
On the main container, this option sets a button on each side to display the previous or next image.
touchControls Boolean
If this parameter is activated, the main container binds the touch movements and displays the previous or next slide. (Only the mobile devices send these events)
verticalCentering Boolean
If the height of the list or the main container is smaller than the height of the image, this option can vertically center the element. To activate, this option must be set to "true".
adaptiveHeight Boolean
If your images have a different height, this option adjusts automatically the global height of the slider.
maxHeight Integer
If you want to set a maximum height to your slider, you can set this option with a number in pixels (without the suffix "px").
beforeSlide Function
This option may contain a function that will be called before each new slide. For example: "function() { console.log('before'); }"
afterSlide Function
In the same way as beforeSlide, the function afterSlide can be called after each slide. For example: "function() { console.log('after'); }"
adaptiveDuration Integer
This duration is the period in milliseconds, during the adjustment of the previous option runs (if it is activated).
transitionDuration Integer
Period of animation in milliseconds between 2 images.
intervalDuration Integer
Interval in milliseconds before displaying of the next image. This option requires "autoSlide" option activated.

Slider API

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