Skip to content

Commit

Permalink
Added cancelThreshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Bryson committed Mar 23, 2013
2 parents 834be22 + 4d8cae3 commit 9054590
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 47 deletions.
36 changes: 34 additions & 2 deletions demos/Thresholds.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script>
<script type="text/javascript" src="../jquery.touchSwipe.min.js"></script>
<script type="text/javascript" src="../jquery.touchSwipe.js"></script>
<script type="text/javascript" src="js/main.js"></script>

<title>touchSwipe</title>
Expand Down Expand Up @@ -52,6 +52,31 @@
});
</script>


<script id='code_3'>
$(function() {
$("#test3").swipe( {
swipe:function(event, direction) {
$(this).text("You swiped " + direction );
},
swipeStatus:function(event, phase, direction, distance, duration, fingers) {

$("#test3").text("Your have swiped " + distance + " px so far");

if(distance>200) {
$("#test3").text("Now swipe back 50px and release to cancel.. distance = " + distance + "px");
}

if (phase=="cancel") {
$("#test3").text("You cancelled the swipe");
}
},
threshold:200,
cancelThreshold:10
});
});
</script>

<span class='title'></span>
<h4>property: <code>threshold</code></h4>
<p>By setting the <code>threshold</code> you can set how far the user must swipe before it is considered a swipe. <br/>Swipe at least 200px</p>
Expand All @@ -60,7 +85,14 @@ <h4>property: <code>threshold</code></h4>
<pre class="prettyprint lang-js" data-src="code_1"></pre>
<span class='navigation'></span>

<div id="test" class="box">Swipe me with for at least 200 px</div>
<div id="test" class="box">Swipe me for at least 200 px</div>

<h4>property: <code>cancelThreshold</code><h4>
<p>By setting the <code>cancelThreshold</code> you can set the minimum distance in px that the user needs to swipe back to cancel the current swipe, even if they have passed the main <code>threshold</code></p>


<pre class="prettyprint lang-js" data-src="code_3"></pre>
<div id="test3" class='box'>Swipe me for at least 200 px, then back 10px to cancel</div>

<h4>property: <code>maxTimeThreshold</code><h4>
<p>By setting the <code>maxTimeThreshold</code> you can set the maximum time the user has to complete the swipe. A swipe LONGER than this is cancelled. This can be useful for ignoring long slow swipes. <br/>Swipe in under 500ms</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h1 class="classTitle">File Index</h1>
</div>
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
<script type="text/javascript">
<!--
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ <h1 class="classTitle">Class Index</h1>
</div>
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h3>Constructor</h3>
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:15 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
30 changes: 29 additions & 1 deletion docs/symbols/$.fn.swipe.defaults.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,34 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B



</div>
</div>
</div>

<div class="jsdoc-member">
<div class="jsdoc-member-definition">
<b><a id="cancelThreshold" href="../symbols/%24.fn.swipe.defaults.html#cancelThreshold">cancelThreshold</a></b>
: int
<span class="jsdoc-member-default">(default = 25)</span>




<span class="jsdoc-inherits-from pull-right"><a href="../symbols/%24.fn.swipe.defaults.html">$.fn.swipe.defaults</a></span>
</div>
<div class="jsdoc-member-description">
<div class="jsdoc-member-content">
<div class="jsdoc-member-summary">
The number of pixels that the user must move their finger back from the original swipe direction to cancel the gesture.
<span class="pull-right"><a href="../symbols/src/jquery.touchSwipe.js.html">code »</a></span>
</div>







</div>
</div>
</div>
Expand Down Expand Up @@ -736,7 +764,7 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.swipe.directions.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.swipe.fingers.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.swipe.html
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ <h3>Events<span class="jsdoc-inherits-caption pull-right">Defined By</span></h3>
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:15 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.swipe.pageScroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.fn.swipe.phases.html
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ <h4>Instance Properties<span class="jsdoc-inherits-caption pull-right">Defined B
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/$.html
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ <h3>Constructor</h3>
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:15 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
2 changes: 1 addition & 1 deletion docs/symbols/_global_.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<footer class="footer">

<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Wed Mar 13 2013 23:05:16 GMT-0000 (GMT)</p>
<p>Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Sat Mar 23 2013 17:50:52 GMT-0000 (GMT)</p>
</footer>
</div></body>
</html>
Loading

0 comments on commit 9054590

Please sign in to comment.