jquery - Bootstrap 旋转木马与超大屏幕中的视频

标签 jquery css html twitter-bootstrap video

我想在超大屏幕中有一个带有视频的 Bootstrap 轮播。其实我应该知道如何做到这一点,但我就是不能让它正常工作!视频在那里,但我只看到了其中的一小部分,其他东西似乎覆盖了它们。我尝试使用 CSS 进行试验,但没有任何方法可以将视频放大到超大屏幕的大小(我希望它们像超大屏幕的背景一样)。

我的 html 设置如下:

<body>
    <div class="jumbotron">
        <div class="carousel slide" id="myCarousel">
            <div class="carousel-inner">
            <div class="item active">
                <div class="container">
                    <div class="flex-video widescreen" style="margin: 0 auto;text-align:center;">2
                        <video id="video-background" preload muted autoplay loop>
                            <source src="images/cerb1.mp4" type="video/mp4">
                        </video>
                    </div>
                </div>
            </div>

            <div class="item">
                <div class="container">
                    <div class="flex-video widescreen" style="margin: 0 auto;text-align:center;">3
                        <video id="video-background" preload muted autoplay loop>
                            <source src="images/cerbkaff.mp4" type="video/mp4">
                        </video>
                    </div>
                </div>
            </div>

            <div class="item">
                <div class="container">
                    <div class="flex-video widescreen" style="margin: 0 auto;text-align:center;">4
                        <video id="video-background" preload muted autoplay loop>
                            <source src="images/cerbkaff2.mp4" type="video/mp4">
                        </video>
                    </div>
                </div>
             </div>
             </div> <!-- carousel-inner -->
            <a data-slide="prev" href="#myCarousel" class="left carousel-control">‹</a>
            <a data-slide="next" href="#myCarousel" class="right carousel-control">›</a>
        </div>

        <div class="container-fluid">
            <h2><b>BLA: BLALBLA BLA BLA TEST</h2>
        </div>
    </div> <!-- end jumbotron -->

我的 CSS 设置:

.jumbotron {
    background-color: rgba(255, 255, 255, 0.075);
    position: relative;
    overflow: hidden;
    height: 400px;
}

.jumbotron .container-fluid {
  position: relative;
  color: #ffffff;
  z-index: 2;
}

#video-background { 
  position: absolute;
  height: auto;
  width: auto;
  min-height: 100%;
  min-width: 100%;
  left: 50%;
  top: 50%;
  -webkit-transform: translate3d(-50%, -50%, 0);
  transform: translate3d(-50%, -50%, 0);
  z-index: 9999;
}

这就是它的错误外观。轮播视频仅显示为一条小线,而它们应占据整个较亮区域(超大屏幕区域)的空间 That's how it faultily looks. The carousel videos are only visible as a little line..

有谁知道我该如何看清这些乱七八糟的东西吗?

最佳答案

视频背景的绝对定位是破坏它的原因。 删除:

position: absolute;

在“video-background”类上一切正常。

请问: https://plnkr.co/edit/63xDn8EaGB3qDLSmtrx4?p=preview

关于jquery - Bootstrap 旋转木马与超大屏幕中的视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37137988/

相关文章:

javascript - 每次发生更改时都使用 jQuery 更新 ruby​​ on Rails 应用程序

javascript - 尝试在 for 循环 jquery 中使用 inner.HTML 生成一个 div

html - 第二排图片库

javascript - 在 jquery 中突出显示相似的 rel 属性

html - 响应式三 Angular 形 div

html - 在 Apache JMeter 中不记录 html 样本

jquery - 如何将 Angular Promise 转换为 jquery 延迟对象

javascript - selenium 没有点击链接,而在 javascript 上,链接被完美点击

javascript - 单击时检索 javascript 对象

javascript - 切换 div 的类以根据单击哪个按钮显示/隐藏内容