Swipe component with touch support (for image carousels, dynamic content etc)
JavaScript
Pull request Compare This branch is 5 commits ahead, 127 commits behind component:master.
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

Readme.md

Swipe

A Fork of component/swipe that falls back to using MarginLeft (for IE 8), emits events, and re-determines size on window resize (useful for full-width carousels)

Installation

$ component install bmcmahen/swipe

Events

show

When an element is shown, event is triggered with index of currently shown event

play

stop

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.

.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.

License

MIT