jquery.mobile.swipe

Swipe.js widget for jQuery Mobile


Keywords
jquery, mobile, swipe, swipejs
License
MIT
Install
bower install jquery.mobile.swipe

Documentation

jquery.mobile.swipe

A jQuery Mobile plugin that makes it easier to include a Swipe component in your app.

Installation

  1. Download the latest release.
  2. Unzip.
  3. Copy swipe.js and jquery.mobile.swipe.js to your project's javascript directory.
  4. Include both files in your HTML code after the jQuery Mobile JavaScript, like so:
<script src="js/jquery.min.js"></script>
<script src="js/jquery.mobile.min.js"></script>
<script src="js/swipe.js"></script>
<script src="js/jquery.mobile.swipe.js"></script>

Basic Usage

In your HTML file use the widget like this:

<div data-role="swipe">
    <div>My first slide</div>
    <div>My second slide</div>
    <div>My third slide</div>
</div>

You are, of course, free to put whatever you want in your slides. The slides do not necessarily have to be <div>s. Here is an example with images:

<div data-role="swipe">
    <img src="img/image1.jpg">
    <img src="img/image2.jpg">
    <img src="img/image3.jpg">
</div>

You can customize the swipe widget with the following data- attributes:

Attribute Description Example
data-start-slide Index position Swipe should start at (default: 0) data-start-slide="3"
data-speed Speed of prev and next transitions in ms (default: 300) data-speed="500"
data-auto Begin with auto slideshow (time in ms between slides) data-auto="2000"

License

MIT