关于< video>的iPad触摸事件标签 [英] iPad touch events on <video> tag

查看:127
本文介绍了关于< video>的iPad触摸事件标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iPad上构建一个支持javascript的画廊,可以显示图像和视频。要浏览图库,您可以向左或向右滑动(类似于iPad的照片应用程序)。但是,在< video>上滑动时,我的触摸事件都不起作用。元件。它似乎接管了我的触摸事件,即使是可能具有更高z-index的元素。我已经尝试添加一个调用e.preventDefault()的touchmove处理程序,但这似乎也不起作用。有没有其他人遇到这个问题并找到了解决方案?

I'm building a javascript-powered gallery on the iPad that can display both images and video. To browse the gallery, you can swipe left or right (similar to the iPad's Photo application). However, none of my touch events work when swiping over a <video> element. It seems to take over my touch events, even on elements that may have a higher z-index. I have tried adding a touchmove handler that calls e.preventDefault(), but that doesn't seem to work either. Has anyone else run into this problem and found a solution for it?

推荐答案

您的触摸事件正被默认控件吸收玩家。如果将视频元素的控件设置为false,则可以完全控制视频元素上的事件。但这样做意味着你必须实现自己的自定义控件,这不是很难。

Your touch events are being absorbed by the default controls of the player. If you set the video element's controls to false you can have full control of the events on the video element. But doing this means you'll have to implement your own custom controls, which isn't very hard.

这篇关于关于&lt; video&gt;的iPad触摸事件标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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