
methods: option
, swipe
From 1.6.11 onwards you can simply re call swipe
and pass a new options hash to update an existing instance
You can also use the legacy option
method to can change any of the init option properties at run time.
see the docs for more info.
$(function() { //Re set any options with a new options hash $("#setMultiple").click(function(){ $("#test").swipe({threshold:0, fingers:2}); alert( "Options are now \n" + JSON.stringify( $("#test").swipe("option") ) ); }); //Get the options hash $("#getAll").click(function(){ alert( JSON.stringify( $("#test").swipe("option") ) ); }); //Legacy set options with the 'option' method $("#setThreshold").change(function(){ $("#test").swipe("option", "threshold", $(this).val() ); }); $("#getThreshold").click(function(){ alert( $("#test").swipe("option", "threshold") ); }); $("#test").swipe( { threshold:200, swipe:function(event, direction, distance, duration, fingerCount){ this.text("You swiped " + distance + "px"); } }); });
Threshold:
Swipe me