Reputation: 11
I've built a carousel with bootstrap following some tutorials. It works fine on my laptop's screen, even when I resize the window, but once I open it on my smartphone, the carousel goes missing and all I see are the indicator arrows plus the image alt text.
The code is pretty standard but here it goes:
<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>
Is there another class the tutorials forgot to mention or do I need to do some work on CSS? Hope you can help me.
Much appreciated
Upvotes: 1
Views: 65
Reputation: 3668
If you're using the latest bootstrap 4 beta then you need to replace "item" with "carousel-item".
Here's your code merged with the example carousel here 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>
Example codepen https://codepen.io/Washable/pen/pWXXje
Upvotes: 1
Reputation: 341
Have you added link of jquery.min file? or give link of the website
Upvotes: 1