【问题标题】:How can I change the color of the youtube player playhead using javascript?如何使用 javascript 更改 youtube 播放器播放头的颜色?
【发布时间】:2020-12-05 11:45:45
【问题描述】:

我想使用 javascript 在 iframe 中更改 youtube 播放头的颜色。 HTML:

 <iframe width="420" height="315"
src="https://www.youtube.com/embed/'Example'">
</iframe> 

我想改变这个 (CSS)

.ytp-swatch-background-color {
    background-color: #f00;
}

到这个 (CSS)

.ytp-swatch-background-color {
    background-color: green;
}

【问题讨论】:

    标签: javascript html css iframe youtube


    【解决方案1】:

    您是否有理由为此使用 javascript?您尝试使用重要来覆盖初始样式。 .ytp-swatch-background-color { 背景色:绿色!重要; }

    如果你想用 javascript 设置样式,你可以这样做

    const ELEMENT = document.querySelector('.ytp-swatch-background-color'); ELEMENT.style.backgroundColor = 'green';
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-11
      • 2011-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-22
      • 2010-10-15
      相关资源
      最近更新 更多