javascript - 我们如何从 YouTube iframe 中删除/隐藏下一个和上一个箭头图标?

标签 javascript reactjs iframe youtube

enter image description here

这是我的 iframe

<iframe
width="100vw"
className="video-frame"
title="Video"
src={url}
frameBorder="0"
controls="0"
autoplay="0"
showinfo="0"
allowFullScreen
/>

请提出一种方法,从我在网站中使用的 YouTube 播放器中删除下一个和上一个图标。

另外,是否有监听器在监听视频是否结束?

最佳答案

您可以访问 iframe 元素。

例如:

<iframe id="frameId" src="/abcd.html" style="height:380px;width:100%"></iframe>

然后在父级

var iframe = document.getElementById("myFrame");
var elmnt = iframe.contentWindow.document.getElementsById("closeBtn")[0];
elmnt.style.display = "none";

在 youTube 框架中找到关闭按钮 ID,然后根据您的要求更改属性

关于javascript - 我们如何从 YouTube iframe 中删除/隐藏下一个和上一个箭头图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58855620/

相关文章:

Javascript Date.getTime 函数没有返回正确的值或者我做错了什么

javascript - 如何在 ReactJS 中将列表中的值存储到对象数组中

JQuery 文件上传插件、Internet Explorer 和 IFrame 传输

javascript - 当请求索引(根路径)时,Flask 应用程序重定向到空的 "about:srcdoc"页面

javascript - iframe 相对自身的位置

javascript - Laravel 集合到 javascript json 然后搜索值

javascript - 如何在 Firefox chrome 中使用自定义全局上下文运行脚本?

javascript - map 在 React 中的第一次迭代后停止迭代

javascript - 如何在 React JS 中将 "dispatch"作为导出函数?

javascript - 在自定义 View 中调用 super() 时,确保传递与传递组件的构造函数相同的 Prop