我正在使用这里找到的 Hammer.js:http:
//eightmedia.github.io/hammer.js/
我像这样设置/创建 Hammer 对象:
var hammertime = Hammer(document.body)
.on("pinchin drag swipe", function(event) {
var alpha_value = $( "#collide_alpha" ).slider( "option", "value" );
var beta_value = $( "#collide_beta" ).slider( "option", "value" );
if(alpha_value < 50) {
$( "#collide_alpha" ).slider( "value", ~~(+alpha_value+(event.gesture.distance/30)) );
} else if(alpha_value <= 100) {
$( "#collide_alpha" ).slider( "value", ~~(+alpha_value-(event.gesture.distance/30)) );
}
if(beta_value < 50) {
$( "#collide_beta" ).slider( "value", ~~(+beta_value+(event.gesture.distance/30)) );
} else if(beta_value <= 100) {
$( "#collide_beta" ).slider( "value", ~~(+beta_value-(event.gesture.distance/30)) );
}
});
之后,我尝试这样做:
// Try to disable the mouse movements on computer
hammertime.STOP_MOUSEEVENTS = true;
hammertime.NO_MOUSEEVENTS = true;
但这不起作用,那么我应该如何仅为计算机禁用事件?但让它们在 iPhone 和 Android 上处于活动状态。目前我并不关心 Windows 8 触摸屏,所以我不介意它不适用于这些触摸屏。