twitter-bootstrap 带按钮的 Bootstrap 3 Carousel
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21777871/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap 3 Carousel with buttons
提问by user3301160
I am new to bootstrap 3 and working on a Carousel for my website. I need to create a carousel with "fade" effect and 4 buttons below the carousel which when clicked trigger the transition between images. I don't want to use the default controls provided by the bootstrap API (left/right arrows and indicators).
我是 Bootstrap 3 的新手,正在为我的网站制作 Carousel。我需要创建一个带有“淡入淡出”效果的旋转木马和旋转木马下方的 4 个按钮,点击后会触发图像之间的过渡。我不想使用 bootstrap API 提供的默认控件(左/右箭头和指示器)。
I want to create something like this - https://moodle.org/
我想创建这样的东西 - https://moodle.org/
Here's my code so far -
到目前为止,这是我的代码 -
<!DOCTYPE html>
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>Carousel Template for Bootstrap</title>
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet">
<link href="carousel.css" rel="stylesheet">
</head>
<body style="padding-left: 50px;padding-right: 50px;">
<div id="myCarousel" data-interval="false" class="carousel slide" data-ride="carousel" >
<div class="carousel-inner">
<div class="item active">
<img alt="First slide" src="1.jpg">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
</div>
</div>
</div>
<div class="item">
<img alt="Second slide" src="1.jpg">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
</div>
</div>
</div>
<div class="item">
<img alt="Third slide" src="1.jpg">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div><!-- /.carousel -->
<div align="center">
<p>Carousel with auto-slide disabled!</p>
</div>
<!-- FOOTER -->
<footer>
<p class="pull-right"><a href="http://getbootstrap.com/examples/carousel/#">Back to top</a></p>
<p>? 2014 Company, Inc. · <a href="http://getbootstrap.com/examples/carousel/#">Privacy</a> · <a href="http://getbootstrap.com/examples/carousel/#">Terms</a></p>
</footer>
</div><!-- /.container -->
<script src="./Carousel Template for Bootstrap_files/jquery.min.js"></script>
<script src="./Carousel Template for Bootstrap_files/bootstrap.min.js"></script>
<script src="./Carousel Template for Bootstrap_files/docs.min.js"></script>
</body></html>
回答by Zim
You can try something like this with Bootstrap..
你可以用 Bootstrap 尝试这样的事情..
It uses the data-targetand data-slide-tonavigate to specific slide.
它使用data-target和data-slide-to导航到特定幻灯片。

