Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Swipe component with touch support (for image carousels, dynamic content etc)
HTML JavaScript Makefile

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
.gitignore
History.md
Makefile
Readme.md
component.json
index.js
package.json

Readme.md

Swipe

Swipe component with touch support, for image carousels or any other content. Try it out the demo in your browser or on your device.

Installation

$ component install component/swipe

API

Swipe(el)

Create a swipe object for el. This should be a container element that wraps a list of several items. View ./example.html for a working example.

.duration(ms)

Set the transition duration, defaults to 300ms.

.interval(ms)

Set the cycle interval, defaults to 5000ms.

.refresh()

This method should be invoked when the swipe element has been resized, or an item has been added or removed.

.play()

Play through all items using the cycle interval.

.stop()

Stop playing.

.isFirst()

Is on the first item.

.isLast()

Is on the last item.

.prev()

Show the previous item if present, or do nothing.

.next()

Show the next item if present, or do nothing.

.show(i, [ms])

Show item with the given index i with the given transition in ms defaulting to the .duration() value.

Emit `show` event.

License

MIT

Something went wrong with that request. Please try again.