简体   繁体   English

我的引导轮播只有指标。 我究竟做错了什么?

[英]My bootstrap carousel only has indicators. What am I doing wrong?

This is the first time I've ever used bootstrap. 这是我第一次使用引导程序。 My bootstrap carousel only has indicators. 我的引导轮播只有指标。 Could this be because I haven't specified pictures yet. 可能是因为我还没有指定图片。

See the following code: 请参见以下代码:

 <!DOCTYPE html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE-edge" /> <meta name="viewport" content="width = device-width, initial-scale = 1" /> <title>Test</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> <style> .jumbotron{ background-color:#2E2D88; color:white; } .tab-content{ border-left: 1px solid #ddd; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 10px; } .nav-tabs{ margin-bottom: 0; } </style> </head> <body> <div class="jumbotron"> <div id="theCarousel" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#theCarousel" data-slide-to="0" class="active"></li> <li data-target="#theCarousel" data-slide-to="1"></li> </ol> <div class="carousel-inner"> <div class="item active"> <div class="slide1"> <div class="carousel-caption"> <h1>Great food</h1> <p>Taste what keeps people coming back</p> <p><a href="#" class="btn btn-primary btn-sm">Order for delivery, carry out, or catering</a></p> </div> </div> </div> <div class="item"> <div class="slide2"> <div class="carousel-caption"> <h1>Great prices</h1> <p>A good meal doesn't have to cost an arm and a leg</p> <p><a href="#" class="btn btn-primary btn-sm">Order for delivery, carry out, or catering</a></p> </div> </div> </div> </div> <a class="left carousel-control" href="#theCarousel" data-slide="prev"></a> <span class="glyphicon glyphicon-chevron-left"></span> <a class="right carousel-control" href="#theCarousel" data-slide="next"></a> <span class="glyphicon glyphicon-chevron-right"></span> </div> <p> Blah blaha blahb lbahlbahbabablah balha blha blah blah </p> </div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> </body> 

Related concerns: I'm not sure if I should be using bootstrap 4 or 3. I've heard bootstrap 4 compiles with sass but I don't know what that is. 相关问题:我不确定我应该使用Bootstrap 4还是3。我听说过Bootstrap 4使用sass编译,但是我不知道这是什么。 Can someone with more experience with this framework help me? 对此框架有更多经验的人可以帮助我吗?

You need to link your images in the carousel-inner class. 您需要在“轮播内部”类中链接图像。

check this for more details : 检查此以获取更多详细信息:

https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_carousel&stacked=h https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_carousel&stacked=h

I wasn't able to get this working until I used examples from https://v4-alpha.getbootstrap.com/components/carousel/ . 在使用https://v4-alpha.getbootstrap.com/components/carousel/中的示例之前,我无法使其正常运行。

Here is what I came up with: 这是我想出的:

 <!DOCTYPE html> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE-edge" /> <meta name="viewport" content="width = device-width, initial-scale = 1" /> <title>Test</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous"> <style> .jumbotron{ background-color:#3e4fa9; border-radius:0px; color:white; } .tab-content{ border-left: 1px solid #ddd; border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 10px; } .nav-tabs{ margin-bottom: 0; } </style> </head> <body> <div class="container"> <div class="page-header"> <h1>Welcome</h1> </div> </div> <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> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="images/sampledining.jpg" alt="First slide"> <div class="carousel-caption d-none d-md-block"> <h3>Great food</h3> <p>Taste what keeps people coming back</p> <p><a href="#" class="btn btn-primary btn-sm">Order for delivery, carry out, or catering</a></p> </div> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="images/samplegyros7.jpg" alt="Second slide"> <div class="carousel-caption d-none d-md-block"> <h3>Great prices</h3> <p>A good meal doesn't have to cost an arm and a leg</p> <p><a href="#" class="btn btn-primary btn-sm">Order for delivery, carry out, or catering</a></p> </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> <div class="jumbotron"> <p> blah blah blah </p> </div> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script> </body> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM