【发布时间】:2015-10-20 11:09:00
【问题描述】:
我想更改 videojs v5 控件布局,以便在 vjs-control-bar 区域顶部制作全宽进度条,类似于 v5 之前的播放器皮肤。
我应该如何进行?是否有必要修改ProgressControl 组件中的component structure tree 或者仅使用CSS 来完成现有的ProgressControl 组件?
我注意到我可以通过将 vjs-progress-control display CSS 属性从 flex 更改为 block、initial 或 inline 将其置于顶部,但我无法将宽度设置为 100% (其他 ProgressControl 组件宽度仍在考虑中)。我认为这是因为vjs-progress-control 仍在容器的弹性流中。
编辑
我取得了一些进展。我可以通过使用以下 CSS 来达到预期的效果:
.vjs-progress-control {
position: absolute;
bottom: 26px; /* The height of the ControlBar minus 4px. */
left: 0;
right: 0;
width: 100%;
height: 10px; /* the height must be reduced from 30 to 10px in order to allow the buttons below (e.g. play) to be pushed */
}
.vjs-progress-holder {/* needed to have a real 100% width display. */
margin-left: 0px;
margin-right: 0px;
}
除非你们中的某个人找到一种方法让它变得更好,否则我会在允许时将此编辑作为已接受的答案发布。
【问题讨论】:
-
我更喜欢你的解决方案而不是公认的答案——代码更少,而且效果很好。其余的真的只是绒毛。
-
您的班级名称前缺少
.。 -
@tmm1 我的错!我刚刚修好了。