触摸事件不会触发iPhone上Safari的视频标签 [英] Touch events are not triggered on video tags on safari for iPhone

查看:159
本文介绍了触摸事件不会触发iPhone上Safari的视频标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过在DOM的文档元素上绑定preventDefault方法来阻止iPhone的Safari浏览器网页上的滚动,并且它对每个元素而是视频标签都有效。

I want to prevent the scrolling on a safari web page for iphone by binding the preventDefault method on the document element of the DOM, and it works on every elements but the video tag.

document.addEventListener("touchmove", function(e){e.preventdefault();}, false);

我尝试将事件附加到视频标签,但似乎没有附加或

I've tried attaching the event to the video tags, but it seems as if nothing is attached or the events are simply not triggered.

推荐答案

在我的测试中,当忽略视频的controls属性时,您可以获得事件....

In my test, when ommiting the "controls" attribute of the video you can get the events....

例如....

<video src="http://192.168.1.53/videoTester/Cuatro.mp4" id="player" width="100%" height="100%" x-webkit-airplay="allow" ></video>

然后把一个div放在顶部...它适用于我....

Then put a div in top... and it works for me....

这篇关于触摸事件不会触发iPhone上Safari的视频标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆