Answer the question
In order to leave comments, you need to log in
How to properly display the carousel?
Unable to display Bootstrap carousel
<div class="bd-example">
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carouselExampleCaptions" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="1"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="2"></li>
<li data-target="#carouselExampleCaptions" data-slide-to="3"></li>
</ol>
<div class="carousel-inner">
{% for post in posts %}
<div class="carousel-item active">
<img src="{{ post.image.url }}" class="d-block w-100" alt="...">
<div class="carousel-caption d-none d-md-block">
<h5>{{ post.title|truncatewords:9 }}</h5>
<p>{{ post.body|truncatewords:15 }}</p>
</div>
</div>
{% endfor %}
</div>
<a class="carousel-control-prev" href="#carouselExampleCaptions" 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="#carouselExampleCaptions" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
An example of a working carousel
Try to simply replace the pictures with your own and run
<div class="carousel slide" data-ride="carousel" id="slides">
<ul class="carousel-indicators">
<li data-target="#slides" data-slide-to="0" class="active"></li>
<li data-target="#slides" data-slide-to="1"></li>
<li data-target="#slides" data-slide-to="2"></li>
<li data-target="#slides" data-slide-to="3"></li>
</ul>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="img/slider/1.jpg">
<div class="carousel-caption">
<h1 class="display-2">Программирование</h1>
<h3>Научитесь программировать</h3>
<button type="button" class="btn btn-ounline btn-lg btn-white">
Подробнее
</button>
<button type="button" class="btn btn-warning btn-lg">
О нас
</button>
</div>
</div>
<div class="carousel-item">
<img src="img/slider/2.jpg">
<div class="carousel-caption">
<div class="container-fluid">
<div class="row juistify-content-start">
<h1 class="design__headline"><span>3D</span> Design</h1>
</div>
</div>
</div>
</div>
<div class="carousel-item">
<img src="img/slider/3.jpg">
</div>
<div class="carousel-item">
<img src="img/slider/4.jpg">
</div>
</div>
</div> <!--end карусель-->
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question