怎么禁用html5,HTML5禁用默认控件(HTML5 disable default controls)

HTML5禁用默认控件(HTML5 disable default controls)

我想知道如何禁用HTML5视频的Showcontrols选项。

这是我想要禁用的:

我想禁用的原因是,如果我使用我的自定义控件,并且如果我将鼠标悬停,我需要显示我的自定义控件,当我离开鼠标时,它应该隐藏控件,问题是当我选择ShowControl时,默认控件显示出我不想要的东西。

任何人都可以建议我如何处理?

C69xt.png

I would like to know how do I disable the Showcontrols options for HTML5 video.

This is what I want to disable:

The reason I want to disable is that If I use my custom controls and If I mouse hover I need to show my custom controls and when I leave the mouse it should hide the controls and the problem is that when I select the ShowControls the default controls is showing up which I dont want.

Can anyone suggest me how do I procees with that?

C69xt.png

原文:https://stackoverflow.com/questions/9854252

更新时间:2020-02-03 23:29

最满意答案

var video = document.getElementById("video"); // assuming "video" is your videos' id

video.removeAttribute("controls");

var video = document.getElementById("video"); // assuming "video" is your videos' id

video.removeAttribute("controls");

相关问答

如果你删除了标签中对控件隐藏的任何引用(它们可能会在第一次加载时闪烁,但是一旦视频加载后它们将保持隐藏状态) controls项是布尔值:如果它存在,那么它们将显示,如果它不,那么他们不会。 要显示和隐藏字幕,您需要将mode设置为“显示”或“隐藏”,如下所示

video.removeAttribute("controls");

例如: http : //jsfiddle.net/dySyv/1/ var video = document.getElementById("video"); // assuming "video" is your videos' id

video.remo

...

这可能是自动完成工作,尝试将其关闭 0

This is probably autocomplete at work, try turning it off

...

看来你有两个选择。 第一个是根据需要简单地删除和替换controls属性。 这将是最简单的解决方案 element.setAttribute('controls', '')

只需在需要时将控件放回原处。 另一种选择是根本不使用浏览器控件,定义自己的自定义控件,并根据需要隐藏或显示它们。 It seems like you have two options here. The first one is to simply remove and replace the controls attrib

...

像这样的东西应该工作: videoElement.onplay = function() {

setTimeout(function() {

videoElement.controls = true;

}, 3000);

};

当然,如果没有控件显示你需要一种方法来启动视频。 如果您启用了autoplay属性,它将自动启动,或者您可以调用videoElement.play()以响应某些事件(例如单击自定义播放按钮)。 如果您希望禁用控件但仍然可视化显示,则可能需要

...

controls是二进制状态,您可以拥有浏览器提供的内容,也可以不拥有任何内容。 如果您不希望浏览器提供全屏控制但仍需要UI,那么您需要关闭控件并使用JavaScript实现自己的UI。 controls is a binary state, you either have what the browser provides or you have nothing. If you don't want the browser to provide a full screen control but

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值