我知道这里已经有几个帖子(但是this one或this one都没有回答),所以我想问一下/在这里说明问题。节点webkit(nw)中的触摸事件
我正在开发一个节点webkit应用程序(“nw”:“^ 0.12.3”)并且存在启用触摸事件的问题。下面的代码工作在铬/铬,但不是在节点的webkit:
document.body.addEventListener('touchstart', function(e){
alert(e.changedTouches[0].pageX);
}, false);
我之前加入“铬ARGS”我的package.json(using this reference)启用了NW特定的标志,我已经试过做同样在这种情况下(见下文),但似乎没有任何工作...
"window": {
"toolbar": true,
"frame": true,
"icon": "icon.png",
"show_in_taskbar": false,
"chromium-args" : {
"--enable-touch-events" : true,
"--enable-pinch" : true,
"--enable-touch-drag-drop" : true,
"--touch-events" : true,
"--enable-touch-drag-drop" : true,
"--ash-touch-hud" : true
}
}
也(为它的价值)
var nw = require('nw.gui');
nw.Screen.Init();
nw.Screen.screens[0].touchSupport; // returns 0
//...even though the monitor is a touchscreen (Dell XPS)
了投票。分享技巧。请分享更多这样的内容。 – YumYumYum