var myVideo = document.getElementById('myVideo');
var deviceAgent = navigator.userAgent.toLowerCase();
var event = deviceAgent.match(/(iphone|ipod|ipad)/) ? 'touchstart' : 'click';
$(document).on(event, '.mejs-fullscreen-button', function () {
if (event == 'click') {
//here it cant catch click event
}//end of click
else {
}//end of touchstart
});
点击或触摸启动事件开始时如何正确映射? 如果(event =='click')在窗口浏览器中无法以任何其他方式编写它?
答案 0 :(得分:1)
您需要将event
传递给您的函数,并使用 event.type :
$(document).on(event, '.mejs-fullscreen-button', function (event) {
if (event.type == 'click') {
//here it cant catch click event
}//end of click
else {
}//end of touchstart
});