0
A
回答
0
0
以下示例显示如何使用文本而不是图像。
setCarouselHeight('#carousel-example');
function setCarouselHeight(id)
{
var slideHeight = [];
$(id+' .item').each(function()
{
// add all slide heights to an array
slideHeight.push($(this).height());
});
// find the tallest item
max = Math.max.apply(null, slideHeight);
// set the slide's height
$(id+' .carousel-content').each(function()
{
$(this).css('height',max+'px');
});
}
.carousel-content {
color:black;
display:flex;
align-items:center;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div id="carousel-example" class="carousel slide" data-ride="carousel">
<!-- Wrapper for slides -->
<div class="row">
<div class="col-xs-offset-3 col-xs-6">
<div class="carousel-inner">
<div class="item active">
<div class="carousel-content">
<div>
<h3>#1</h3>
<p>This is a twitter bootstrap carousel that only uses text. There are no images in the carousel slides.</p>
</div>
</div>
</div>
<div class="item">
<div class="carousel-content">
<div>
<h3>#2</h3>
<p>This is another much longer item. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi, sint fuga temporibus nam saepe delectus expedita vitae magnam necessitatibus dolores tempore consequatur dicta cumque repellendus eligendi ducimus placeat! Sapiente, ducimus, voluptas, mollitia voluptatibus nemo explicabo sit blanditiis laborum dolore illum fuga veniam quae expedita libero accusamus quas harum ex numquam necessitatibus provident deleniti tenetur iusto officiis recusandae corporis culpa quaerat?</p>
</div>
</div>
</div>
<div class="item">
<div class="carousel-content">
<div>
<h3>#3</h3>
<p>This is the third item.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Controls --> <a class="left carousel-control" href="#carousel-example" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
相关问题
- 1. Bootstrap Carousel在屏幕图像
- 2. 是否必须使用SSL?
- 3. Bootstrap Carousel图像不能全宽显示
- 4. 是否必须使用“remember_token”字段?
- 5. 是否必须使用flags属性?
- 6. 分配时是否必须使用initWithString?
- 7. 我是否必须使用onPause/onStart/onDestroy
- 8. Mercurial Server是否必须使用Mercurial?
- 9. 我是否必须使用UNION insted JOIN?
- 10. Bootstrap行元素是否必须是列的直接子元素?
- 11. OCTAVE - ind2rgb:X必须是索引图像
- 12. LinearLayout中的图像是否必须具有相同的大小?
- 13. 我是否必须为iOS 8启动图像提供LaunchScreen.xib?
- 14. 用户ID是否必须是整数?
- 15. 您是否必须使用TriggerIO指定Native标签栏的图像分辨率
- 16. 是否必须跟随ELSE
- 17. WriteStream是否必须关闭?
- 18. UIPageViewController是否必须全屏?
- 19. Bootstrap Carousel-inner“autoplay”
- 20. Bootstrap API Carousel Continuous
- 21. Bootstrap Carousel with Meteor
- 22. Bootstrap Carousel Not Loading
- 23. Bootstrap Carousel MyCarousel.carousel(number)
- 24. Meteor and Bootstrap Carousel
- 25. Bootstrap Matrix Carousel
- 26. Scaling Bootstrap Carousel
- 27. Bootstrap Carousel Customization
- 28. Simple Bootstrap Carousel
- 29. Bootstrap Carousel Caption Animation
- 30. Parallax.js和Bootstrap Carousel
你试试下面的方法? [approach1](http://codepen.io/matthewhirsch/pen/OPwQRL)[approach2](http://bootsnipp.com/snippets/featured/bootstrap-carousel-with-text)[approach3](http:// jsfiddle.net/technotarek/gXN2u/) –