无论屏幕高度或宽度如何,我如何让我的Boostrap旋转木马占据整个屏幕?

时间:2017-03-15 16:30:42

标签: jquery css twitter-bootstrap

我希望图像能够拉伸整个屏幕。

我对这个旋转木马有两个问题。

  • 案例1.屏幕太窄。底部有一条白色条带 Example.

  • 案例2.屏幕太宽。无法看到旋转木马指示灯。 Example.

当我添加第五张幻灯片时,没有图片,只需将轮播项目设为红色即可。令人惊讶的是,该项目跨越了整个屏幕高度。所以现在,我想知道图像所在的项目是否跨越整个屏幕高度,并且图像设置为高度:100%(其中的项目),如果图像填满整个屏幕高度同样。

.full{
  width:100%;
  height:100%;

}

.color{
  background:red;
}

html,body{height:100%;}
.carousel,.item,.active{height:100%;}
.carousel-inner{height:100%;}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <div id="myCarousel" class="carousel slide fill" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="#myCarousel" data-slide-to="1"></li>
    <li data-target="#myCarousel" data-slide-to="2"></li>
    <li data-target="#myCarousel" data-slide-to="3"></li>
    <li data-target="#myCarousel" data-slide-to="4"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner  role="listbox">
    <div class="item active">
      <img  class="full" src="https://static.pexels.com/photos/36764/marguerite-daisy-beautiful-beauty.jpg" alt="Chania" >
    </div>

    <div class="item">
      <img class="full" src="https://static.pexels.com/photos/36753/flower-purple-lical-blosso.jpg" alt="Chania">
    </div>

    <div class="item">
      <img class="full" src="https://static.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg" alt="Flower">
    </div>

    <div class="item">
      <img class="full" src="https://s-media-cache-ak0.pinimg.com/736x/ce/6e/77/ce6e7783134c1995b9c56ad9e9b96f76.jpg" alt="Flower ">
    </div>
                                                                                                                                   
   <div class="item color">
      
    </div >  
                                                                                                                                   
                                                                                </div>

  <!-- Left and right controls -->
  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>
   
      </div>
  
</div>

  

0 个答案:

没有答案