UNPKG

hammerjs

Version:

A javascript library for multi-touch gestures

367 lines (203 loc) 10.9 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Swipe - Hammer.JS</title> <link rel="stylesheet" href="http://yui.yahooapis.com/3.8.0pr2/build/cssgrids/cssgrids-min.css"> <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css"> <link rel="stylesheet" href="../assets/css/main.css" id="site_styles"> <script src="http://yui.yahooapis.com/combo?3.8.0pr2/build/yui/yui-min.js"></script> </head> <body class="yui3-skin-sam"> <div id="doc"> <div id="hd" class="yui3-g header"> <div class="yui3-u-3-4"> <h1><a href="../index.html">Hammer.JS: Swipe</a></h1> </div> <div class="yui3-u-1-4 version"> <em>API Docs for: 1.1.0</em> </div> </div> <div class="yui3-g"> <div id="sidebar" class="yui3-u"> <div id="modules" class="sidebox"> <div class="hd"> <h2 class="no-toc">Modules</h2> </div> <div class="bd"> <ul> <li><a href="../modules/gestures.html">gestures</a> </li> <li><a href="../modules/hammer.html">hammer</a> </li> </ul> </div> </div> <div id="classes" class="sidebox"> <div class="hd"> <h2 class="no-toc">Classes</h2> </div> <div class="bd"> <ul> <li><a href="../classes/Detection.html">Detection</a></li> <li><a href="../classes/Drag.html">Drag</a></li> <li><a href="../classes/Event.html">Event</a></li> <li><a href="../classes/Gesture.html">Gesture</a></li> <li><a href="../classes/Hammer.html">Hammer</a></li> <li><a href="../classes/Hold.html">Hold</a></li> <li><a href="../classes/Instance.html">Instance</a></li> <li><a href="../classes/PointerEvent.html">PointerEvent</a></li> <li><a href="../classes/Release.html">Release</a></li> <li><a href="../classes/Swipe.html">Swipe</a></li> <li><a href="../classes/Tap.html">Tap</a></li> <li><a href="../classes/Touch.html">Touch</a></li> <li><a href="../classes/Transform.html">Transform</a></li> <li><a href="../classes/Utils.html">Utils</a></li> </ul> </div> </div> <div id="events-on-page" class="sidebox on-page"> <div class="hd"> <h2 class="no-toc">Events On Page</h2> </div> <div class="bd"> <ul> <li><a href="#events_swipe">swipe</a></li> <li><a href="#events_swipedown">swipedown</a></li> <li><a href="#events_swipeleft">swipeleft</a></li> <li><a href="#events_swiperight">swiperight</a></li> <li><a href="#events_swipeup">swipeup</a></li> </ul> </div> </div> <div id="fileTree" class="sidebox"> <div class="hd"> <h2 class="no-toc">Files</h2> </div> <div class="bd"> <ul><li>src/<ul><li><a href="../files/src_detection.js.html">detection.js</a></li><li><a href="../files/src_event.js.html">event.js</a></li><li><a href="../files/src_export.js.html">export.js</a></li><li>gestures/<ul><li><a href="../files/src_gestures_drag.js.html">drag.js</a></li><li><a href="../files/src_gestures_gesture.js.html">gesture.js</a></li><li><a href="../files/src_gestures_hold.js.html">hold.js</a></li><li><a href="../files/src_gestures_release.js.html">release.js</a></li><li><a href="../files/src_gestures_swipe.js.html">swipe.js</a></li><li><a href="../files/src_gestures_tap.js.html">tap.js</a></li><li><a href="../files/src_gestures_touch.js.html">touch.js</a></li><li><a href="../files/src_gestures_transform.js.html">transform.js</a></li></ul></li><li><a href="../files/src_instance.js.html">instance.js</a></li><li><a href="../files/src_pointerevent.js.html">pointerevent.js</a></li><li><a href="../files/src_setup.js.html">setup.js</a></li><li><a href="../files/src_utils.js.html">utils.js</a></li></ul></li></ul> </div> </div> </div> <div id="main" class="yui3-u"> <div class="content"><h4>Class Swipe</h4> <span class="foundat">Class defined in: <a href="../files/src_gestures_swipe.js.html#l4"><code>src&#x2F;gestures&#x2F;swipe.js:4</code></a></span> <div class="intro"><p>triggers swipe events when the end velocity is above the threshold for best usage, set <code>prevent_default</code> (on the drag gesture) to <code>true</code></p> <pre class="code prettyprint"><code> hammertime.on(&quot;dragleft swipeleft&quot;, function(ev) { console.log(ev); ev.gesture.preventDefault(); });</code></pre> </div> <div id="classdocs"> <ul> <li><a href="#props">Properties</a></li> <li><a href="#events">Events</a></li> </ul> <div> <div id="props"> <a name="props_swipe_max_touches"></a> <div class="props item"> <code>swipe_max_touches</code> &lt;<strong><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></strong>&gt; <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l48"><code>src&#x2F;gestures&#x2F;swipe.js:48</code></a></span> <strong>Default:</strong> 1 </div> <a name="props_swipe_min_touches"></a> <div class="props item"> <code>swipe_min_touches</code> &lt;<strong><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></strong>&gt; <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l41"><code>src&#x2F;gestures&#x2F;swipe.js:41</code></a></span> <strong>Default:</strong> 1 </div> <a name="props_swipe_velocity_x"></a> <div class="props item"> <code>swipe_velocity_x</code> &lt;<strong><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></strong>&gt; <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l55"><code>src&#x2F;gestures&#x2F;swipe.js:55</code></a></span> <p>horizontal swipe velocity</p> <strong>Default:</strong> 0.7 </div> <a name="props_swipe_velocity_y"></a> <div class="props item"> <code>swipe_velocity_y</code> &lt;<strong><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></strong>&gt; <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l63"><code>src&#x2F;gestures&#x2F;swipe.js:63</code></a></span> <p>vertical swipe velocity</p> <strong>Default:</strong> 0.6 </div> </div> <div id="events"> <a name="events_swipe"></a> <div class="events item"> <code>swipe</code> <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l17"><code>src&#x2F;gestures&#x2F;swipe.js:17</code></a></span> <strong>Extra event object properties:</strong> <ul> <li> <code>ev</code> <strong>&lt;<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a>&gt;</strong> </li> </ul> </div> <a name="events_swipedown"></a> <div class="events item"> <code>swipedown</code> <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l33"><code>src&#x2F;gestures&#x2F;swipe.js:33</code></a></span> <strong>Extra event object properties:</strong> <ul> <li> <code>ev</code> <strong>&lt;<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a>&gt;</strong> </li> </ul> </div> <a name="events_swipeleft"></a> <div class="events item"> <code>swipeleft</code> <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l21"><code>src&#x2F;gestures&#x2F;swipe.js:21</code></a></span> <strong>Extra event object properties:</strong> <ul> <li> <code>ev</code> <strong>&lt;<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a>&gt;</strong> </li> </ul> </div> <a name="events_swiperight"></a> <div class="events item"> <code>swiperight</code> <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l25"><code>src&#x2F;gestures&#x2F;swipe.js:25</code></a></span> <strong>Extra event object properties:</strong> <ul> <li> <code>ev</code> <strong>&lt;<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a>&gt;</strong> </li> </ul> </div> <a name="events_swipeup"></a> <div class="events item"> <code>swipeup</code> <br> <span class="foundat"><a href="../files/src_gestures_swipe.js.html#l29"><code>src&#x2F;gestures&#x2F;swipe.js:29</code></a></span> <strong>Extra event object properties:</strong> <ul> <li> <code>ev</code> <strong>&lt;<a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a>&gt;</strong> </li> </ul> </div> </div> </div> </div> </div> </div> </div> </div> <script src="../assets/vendor/prettify/prettify-min.js"></script> <script>prettyPrint();</script> <script src="../assets/js/yui-prettify.js"></script> <script src="../assets/js/tabs.js"></script> </body> </html>