我已经根据一些教程构建了一个带引导程序的轮播。 它在我的笔记本电脑的屏幕上工作正常,即使我调整窗口大小,但是一旦我在智能手机上打开它,旋转木马就会丢失,所有我看到的都是指示箭头和图像替代文字。
代码很标准,但在这里:
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio1</h1>
</div>
</div>
<div class="item">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio2</h1>
</div>
</div>
<div class="item">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio3</h1>
</div>
</div>
</div>
是否还有其他课程,教程忘记提及或者我需要在CSS上做一些工作吗?希望你能帮帮我。
非常感谢
答案 0 :(得分:1)
您是否添加了jquery.min文件的链接? 或提供网站链接
答案 1 :(得分:1)
如果您使用的是最新的bootstrap 4 beta,那么您需要将“item”替换为“carousel-item”。
这是您的代码与示例轮播合并https://getbootstrap.com/docs/4.0/components/carousel/#with-indicators
<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>
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio1</h1>
</div>
</div>
<div class="carousel-item">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio2</h1>
</div>
</div>
<div class="carousel-item">
<img src="http://s1.picswalls.com/wallpapers/2016/03/29/beautiful-nature-wallpaper_042325903_304.jpg" alt="portfolio1">
<div class="carousel-caption">
<h1>Portfolio3</h1>
</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>