2016-11-02 61 views
2

林幾乎是一個新手,編碼和香港專業教育學院一直在努力做一個滑塊上引導了whle但它不是真正的工作,因爲它變得像一個背景是什麼引導轉盤不工作,而是變成背景圖像

繼承人我的HTML

<body> 
    <div class="navbar navbar-default navbar-fixed-top" role="navigation"> 
     <div class= "container"> 
      <div class="navbar-header"> 
       <a class="navbar-brand" href"#"> 
        <img src="img/logowine.png" alt="winelogo"> 
       </a> 
       <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar"> 
        <span class="sr-only">Toggle navigation</span> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 
       </button> 
      </div> 
      <div id="mynavbar" class="navbar-collapse collapse"> 
       <ul class="nav navbar-nav navbar-right"> 
        <li class="active"> 
         <a href="#">Home</a> 
        </li> 
        <li> 
         <a href="#about">About </a> 
        </li> 
        <li> 
         <a href="#product">Products</a> 
        </li> 
        <li> 
         <a href="#contact">Contact</a> 
        </li> 
       </ul> 
      </div> 
     </div> 
    </div> 
    <div id="myCarousel" class="carousel slide" data-ride="carousel" > 
     <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> 
     </ol> 
     <div class="carousel-inner" role="listbox"> 
      <div clas="item active"> 
       <img src="img/carousel1.jpg" alt="portdicksonrj" class="img-responsive"> 
      </div> 
      <div clas="item"> 
       <img src="img/carousel2.jpg" alt="portdicksonrjice" class="img-responsive"> 
      </div> 
      <div clas="item"> 
       <img src="img/carousel3.jpg" alt="portdicksonrjlemon" class="img-responsive"> 
      </div> 
     </div> 
    </div> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
    <script src="js/bootstrap.min.js"></script> 
    <script> 
     $("#carousel").carousel(); 
    </script> 




</body> 

它出來像 this this

+0

你有bootsrap CSS就可以了聯繫? –

+0

參見: http://www.w3schools.com/bootstrap/bootstrap_ref_js_carousel.asp – 000

回答

1

你錯過小號pellingclass word只是改變你的HTMLclas改爲class解決你的問題。

注:同時請確保它,你是添加引導CSS

注:我編輯您的問題所以現在它的工作好。

看看我的Bootstrap旋轉木馬。

.carousel-inner > .item > img, 
 
    .carousel-inner > .item > a > img { 
 
     width: 70%; 
 
     margin: auto; 
 
} 
 

 
.item img { 
 
    height: 400px !important 
 
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 

 
<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> 
 
<li data-target="#myCarousel" data-slide-to="4"></li> 
 
    </ol> 
 

 
    <!-- Wrapper for slides --> 
 
    <div class="carousel-inner" role="listbox"> 
 
     <div class="item active"> 
 
     <img src="https://upload.wikimedia.org/wikipedia/commons/4/47/Goole.jpg" alt="Chania 1" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
     <img src="https://peterwardhomes.files.wordpress.com/2014/12/goole-area-shot_005.jpg" alt="Chania" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
     <img src="http://www.telegraph.co.uk/content/dam/Travel/Destinations/Europe/France/Nice/Nice-nightlife-coastline-xlarge.jpg" alt="Flower 1" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
     <img src="http://i.telegraph.co.uk/multimedia/archive/01858/nice3_1858695b.jpg" alt="Flower" width="460" height="345"> 
 
     </div> 
 

 
     <div class="item"> 
 
     <img src="http://eastriding.limehouse.co.uk/events/21318/images/highresRGB/2376387_0_1.jpg" alt="Flower" width="460" height="345"> 
 
     </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>

0

試試這個代碼..

<div id="myCarousel" class="carousel slide" data-ride="carousel"> 
    <!-- 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> 
    </ol> 
    <!-- Wrapper for carousel items --> 
    <div class="carousel-inner"> 
     <div class="item active"> 
      <img src="img/carousel1.jpg" alt="First Slide"> 
     </div> 
     <div class="item"> 
      <img src="img/carousel1.jpg" alt="Second Slide"> 
     </div> 
     <div class="item"> 
      <img src="img/carousel1.jpg" alt="Third Slide"> 
     </div> 
    </div> 
    <!-- Carousel controls --> 
    <a class="carousel-control left" href="#myCarousel" data-slide="prev"> 
     <span class="glyphicon glyphicon-chevron-left"></span> 
    </a> 
    <a class="carousel-control right" href="#myCarousel" data-slide="next"> 
     <span class="glyphicon glyphicon-chevron-right"></span> 
    </a> 
</div>