FormidableLabs/Swipe

Name: Swipe

Owner: Formidable

Description: Swipe is the most accurate touch slider.

Created: 2013-09-17 18:30:05.0

Updated: 2016-05-08 02:10:29.0

Pushed: 2013-07-27 23:13:44.0

Homepage: swipejs.com

Size: 701

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Usage

Swipe only needs to follow a simple pattern. Here is an example:

 id='slider' class='swipe'>
iv class='swipe-wrap'>
<div></div>
<div></div>
<div></div>
div>
v>

Above is the initial required structure? a series of elements wrapped in two containers. Place any content you want within the items. The containing div will need to be passed to the Swipe function like so:

ow.mySwipe = Swipe(document.getElementById('slider'));

I always place this at the bottom of the page, externally, to verify the page is ready.

Also Swipe needs just a few styles added to your stylesheet:

pe {
erflow: hidden;
sibility: hidden;
sition: relative;

pe-wrap {
erflow: hidden;
sition: relative;

pe-wrap > div {
oat:left;
dth:100%;
sition: relative;

Config Options

Swipe can take an optional second parameter? an object of key/value settings:

Example
ow.mySwipe = new Swipe(document.getElementById('slider'), {
artSlide: 2,
eed: 400,
to: 3000,
ntinuous: true,
sableScroll: false,
opPropagation: false,
llback: function(index, elem) {},
ansitionEnd: function(index, elem) {}

Swipe API

Swipe exposes a few functions that can be useful for script control of your slider.

prev() slide to prev

next() slide to next

getPos() returns current slide index position

getNumSlides() returns the total amount of slides

slide(index, duration) slide to set index position (duration: speed of transition in milliseconds)

Browser Support

Swipe is now compatible with all browsers, including IE7+. Swipe works best on devices that support CSS transforms and touch, but can be used without these as well. A few helper methods determine touch and CSS transition support and choose the proper animation methods accordingly.

Who's using Swipe

Shoot me a note if you want your logo here


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.