【发布时间】:2021-09-28 11:55:09
【问题描述】:
我已经追了好几个小时了。我读过同样的问题here 和here
在我的 Mac 上使用 ios iphone 模拟器时,我的 Cordova 应用程序基本上对点击事件没有响应。它在iphone中也没有响应。执行cordova run browser 时在浏览器中工作正常。我需要提一下,是的,一切都在deviceready 内,所以这不是问题。唯一有效的是href。其他一切都没有反应。解决办法是什么?
html
<button id="pressOn">press me</button>
我试过了:
这个
$("#pressOn").on("touchend", openPage('login'));
这个
$("#pressOn").on("touchstart", openPage('login'));
这个
let touchEvent = 'ontouchstart' in window ? 'touchstart' : 'click';
$('#pressOn').on(touchEvent, openPage('login'));
没有任何作用...没有任何反应。
但是,当应用程序出现在模拟器上时,它会以某种方式触发(我没有做/触摸任何事情)
document.getElementById('pressOn').addEventListener('touchstart', alert('cheer up!'), false);
【问题讨论】: