【问题标题】:YouTube Title, Share, Watch Button RemovedYouTube 标题、分享、观看按钮已移除
【发布时间】:2019-02-08 11:22:34
【问题描述】:

当我尝试将视频用作网站背景时,标题和按钮会出现在 Youtube 视频的顶部。我希望从嵌入的 Youtube 顶部删除标题、观看和分享按钮。我已经尝试了所有方法,但没有任何效果。

我已附上我的代码。我尝试用 jQuery 注入它,但一点运气都没有。

<iframe src="https://www.youtube.com/embed/5iNr0Tp13hY?mode=opaque&rel=0&autohide=1&showinfo=0&controls=0&wmode=transparent" frameborder="0" width="100%" height="100%"></iframe>
$('iframe').load(function() {
  $('iframe').contents().find("head").append($("<style type='text/css'>  .ytp-chrome-top.ytp-show-watch-later-title.ytp-share-button-visible.ytp-show-share-title.ytp-show-cards-title { display: none !important; } </style>"));
});

【问题讨论】:

标签: javascript jquery html youtube


【解决方案1】:

不要使用 iFrame,而是使用 jquery.mb.YTPlayer,这样更容易。

调用 .js 文件到你的 HTML

&lt;script src="style/js/jquery.mb.YTPlayer.js"&gt;&lt;/script&gt;

并用

调用视频

&lt;div id="P1" class="player video-container" data-property="{videoURL:'https://www.youtube.com/watch?XXXXXXX',containment:'#video', autoPlay:true, showControls:false, mute:true, startAt:6, opacity:1, loop:1}"&gt;&lt;/div&gt;

showControls:false 隐藏控件,您拥有文档中的所有选项。

【讨论】:

    猜你喜欢
    • 2016-03-17
    • 2019-03-30
    • 2019-06-07
    • 2019-10-04
    • 2021-05-18
    • 1970-01-01
    • 1970-01-01
    • 2020-08-31
    • 1970-01-01
    相关资源
    最近更新 更多