如何在Bootstrap 4中创建全角视频轮播?

时间:2019-01-05 02:16:47

标签: video header bootstrap-4 carousel

我正在创建一个投资组合网站,并且我想使用Bootstrap4为主页创建全角视频轮播。我研究了如何以正确的方式创建它,但是仍然遇到麻烦。当前,第一张幻灯片有一个视频,但是它显示控件,并且一旦结束就不会重播。一旦该幻灯片上的视频结束,我想转到下一张幻灯片。我目前在后两张幻灯片中都有图片。当我尝试在这些幻灯片中放入视频文件时,它不会显示在预览中。您将如何编码?任何帮助将不胜感激 !谢谢!

以下是我当前的轮播代码:

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<div id="carouselExampleIndicators" class="carousel slide" data- 
    ride="carousel">
    <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" 
    class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
    </ol>
    <!-- First Slide -->
    <div class="carousel-inner">
    <div class="carousel-item active">
      <div class="embed-responsive embed-responsive-16by9">
    <iframe class="embed-responsive-item" 
     src="video/jzportfolioheader1.mp4" allowfullscreen=""></iframe>
     </div>
        <div class="carousel-caption d-none d-md-block">
     <h2>Hi, I'm John.</h2>
     <p>I'm a Junior Web Developer</p>
     </div>
     </div>
    
     <!-- Second Slide -->
     <div class="carousel-item">
      <img class="d-block w-100" src="images/jzportfolio2.png" 
     alt="Second slide">
      <div class="carousel-caption d-none d-md-block">
     <h2>Adobe Creative Cloud - Design</h2>
     <p>I use Adobe Photoshop, Illustrator, inDesign, After Effects, 
      Premiere Pro, and Animate to design cool websites.</p>
      <button type="button" class="btn btn-primary btn-lg">More 
     Info</button>      
     </div>
     </div>
    
     <!-- Third Slide -->
     <div class="carousel-item">
      <img class="d-block w-100" src="images/jzportfolio1.png" 
     alt="Third slide">
      <div class="carousel-caption d-none d-md-block">
          <h2>Web Dev Tools</h2>
        <p>I use HTML5, CSS3, Javascript, Wordpress, Bootstrap 4.0, 
     jQuery, and Adobe Dreamweaver to develop amazing websites.</p>
        <button type="button" class="btn btn-primary btn-lg">More 
     Info</button>  
     </div>
      </div>
     </div>
     <a class="carousel-control-prev" href="#carouselExampleIndicators" 
     role="button" data-slide="prev">
     <span class="carousel-control-prev-icon" aria-hidden="true"></span>
     <span class="sr-only">Previous</span>
     </a>
     <a class="carousel-control-next" href="#carouselExampleIndicators" 
     role="button" data-slide="next">
     <span class="carousel-control-next-icon" aria-hidden="true"></span>
     <span class="sr-only">Next</span>
     </a>
     </div>
     <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
      <script       src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js">       </script>

0 个答案:

没有答案