屏幕图像中的Bootstrap Carousel

时间:2017-02-14 19:04:51

标签: html css twitter-bootstrap carousel gallery

我想在PC屏幕图像中放置一个Bootstrap Carousel滑块,所以我希望它完全适合该屏幕并且也能够响应。

我不知道哪种方式最好,但我尝试将屏幕图像设置为css中滑块的背景图像,但它不起作用。谁能帮我?或者有更好的主意?

例如: screen (这个例子有很多屏幕,但是我想要实现的精神)

轮播代码:



<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link rel="stylesheet" href="main.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>


</head>
<body>

<div class="container">
  <br>
  <div id="myCarousel" class="carousel slide" 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>
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner screen" role="listbox">

      <div class="item active">
        <img src="http://placehold.it/712x400">
      </div>

      <div class="item">
        <img src="http://placehold.it/712x400">
      </div>
    
      <div class="item">
        <img src="http://placehold.it/712x400" >
      </div>
  
      </div>
 
    </div>

  </div>

</body>
</html>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:3)

我有同样的问题,但终于找到了解决方案!

您可以尝试此模型:HTML5 DEVICE MOCKUPS

<div class="device-mockup" data-device="iphone5" data-orientation="portrait" data-color="black">
            <div class="device">
                <div class="screen">
                    <!-- PUT CONTENTS HERE -->
                    You can put your slider here. The images will be automatically responsive with the device. 
                </div>
                <div class="button">
                    <!-- You can hook the "home button" to some JavaScript events or just remove it -->
                </div>
            </div>
        </div>

阅读文档及其对github的解释。希望这有帮助!