html - 使 html5 视频 div 可点击并转到超链接
问题描述
我目前有一个视频链接
<video onclick="location.href='/video';" width="320" height="240" controls loop autoplay>
<source src="/static/backgroundremover.mp4" type="video/mp4">
<source src="/static/backgroundremover.ogg" type="video/ogg">
<img src="/static/backgroundremover.gif">
Your browser does not support the video tag.
</video>
但是上面的 div 我把它包裹在一个<a href>
但每次我点击任何视频时它只是暂停视频而不是转到超链接。
当有人点击视频让它转到另一个网址时,我该怎么做,即/video
解决方案
在评论的一些帮助之后,我问了这个问题,在回答这个问题时我回答了这个问题,所以我会继续在这里发布它,但是工作的 css 和 html。
#video { position: relative; left: 0px; top: 0px; min-height: 100%;
min-width: 100%; z-index: 9997; }
#overlay { position: absolute; left: 0px; top: 0px; height: 100%; width: 100%;
z-index: 9998; }
#main_container {position: relative; left:0; top:0; }
和 html
<div id="main_container"class="d-none d-md-block">
<div id="overlay"></div>
<video id="video" width="320" height="240" controls loop autoplay>
<source src="/static/backgroundremover.mp4" type="video/mp4">
<source src="/static/backgroundremover.ogg" type="video/ogg">
<img src="/static/backgroundremover.gif">
Your browser does not support the video tag.
</video>
</div>
推荐阅读
- python - 如何在python中拆分数组中的每个值?
- vba - 如何将 Outlook 邮件转换为保持双字节字符集的文本?
- angular - 如何解析上传文件的 MIDI 内容?
- reactjs - 父状态更改时子组件不更新
- php - 使用带有 FileType 的转换器
- excel - VBA 代码无法很好地跨多个工作簿进行复制和粘贴
- c++ - C++ 和 SDL2 网格移动太快
- android - 使用 ConstraintLayout 在横向模式下居中对齐 ImageButton
- python - 如何获取嵌套列表python中每列的最大值?
- c++ - 为什么在公共数据成员之前使用“静态”关键字?