【问题标题】:Touch Events stop working on iPad after the Video tag视频标签后触控事件在 iPad 上停止工作
【发布时间】:2013-09-16 12:40:58
【问题描述】:

我有一个应用程序,可以让您左右滑动来查看不同的屏幕,或者单击“下一个”和“上一个”按钮进行导航。

if(isMobile){
    detectSwipe = true;
    document.addEventListener('touchstart',TouchStart,false);
    document.addEventListener('touchmove',TouchMove,false);
    document.addEventListener('touchend',TouchEnd,false);
    document.addEventListener('touchend',TouchCancel,false);
}

$("#prevBtn").on('touchstart click', function () { 
    ...
}

问题是由于某种未知原因,当它到达带有视频标签的屏幕时,所有按钮都变得无法点击,只有滑动事件仍然处于活动状态。这只发生在 iPad 上,但在桌面上可以正常工作。

<video width="960" height="560">
    <source src="video.mp4" type="video/mp4"/>
    <source src="video.ogg" type="video/ogg"/>
    <source src="video.webm" type="video/webm"/>
    Your browser does not support the video tag.
</video>

我也尝试使用嵌入 youtube 视频而不是视频标签,但问题仍然存在。

【问题讨论】:

  • 如果可能的话,你能发个小提琴吗...
  • 很遗憾没有,完整的代码超过 14000 行

标签: javascript html ipad video touch


【解决方案1】:

您必须将视频元素的控件设置为 false 并设置您自己的控件,它才能工作。

【讨论】:

  • 遗憾的是,这不是一个选择。我不得不使用默认控件
猜你喜欢
  • 1970-01-01
  • 2021-12-15
  • 1970-01-01
  • 2011-03-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-28
  • 2013-01-15
相关资源
最近更新 更多