我需要一个轮播,每张幻灯片显示 3 个团队成员对象。
<div class="carousel-inner" role="listbox">
{% for m in memb %}
{% if forloop.first %}
<div class="carousel-item active">
{% else %}
<div class="carousel-item">
{% endif %}
<div class="row">
<div class="col-sm-4">
<div class="team-member"><img class="rounded-circle mx-auto" src="{{ m.image1.url }}">
<h4>{{ m.name1 }}</h4>
<ul class="list-inline social-buttons" style="margin-top: 20px;">
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#{{ m.facebook1 }}"><i class="fa fa-facebook"></i></a></li>
<li class="list-inline-item"><a href="#{{ m.instagram1 }}"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
</div>
<div class="col-sm-4">
<div class="team-member"><img class="rounded-circle mx-auto" src="{{ m.image2.url }}">
<h4>{{ m.name2 }}</h4>
<ul class="list-inline social-buttons" style="margin-top: 20px;">
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#{{ m.facebook2 }}"><i class="fa fa-facebook"></i></a></li>
<li class="list-inline-item"><a href="#{{ m.instagram2 }}"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
</div>
<div class="col-sm-4">
<div class="team-member"><img class="rounded-circle mx-auto" src="{{ m.image3.url }}">
<h4>{{ m.name3 }}</h4>
<ul class="list-inline social-buttons" style="margin-top: 20px;">
<li class="list-inline-item"></li>
<li class="list-inline-item"><a href="#{{ m.facebook3 }}"><i class="fa fa-facebook"></i></a></li>
<li class="list-inline-item"><a href="#{{ m.instagram3 }}"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
<div><a class="carousel-control-prev" href="#carousel-3" role="button" data-slide="prev" style="width: 50px;"><span class="carousel-control-prev-icon border rounded-circle" style="background-color: #000000;"></span><span class="sr-only">Previous</span></a>
<a
class="carousel-control-next" href="#carousel-3" role="button" data-slide="next" style="width: 50px;"><span class="carousel-control-next-icon border rounded-circle" style="background-color: #000000;"></span><span class="sr-only">Next</span></a>
</div>
<ol class="carousel-indicators">
<li data-target="#carousel-3" data-slide-to="0" class="active"></li>
<li data-target="#carousel-3" data-slide-to="1"></li>
<li data-target="#carousel-3" data-slide-to="2"></li>
</ol>
</div>
</div>
我无法弄清楚如何动态创建 1 个项目,所以我添加了每个项目的 3 个变量(image1、image2、image3 等)
主要问题是我的控件不起作用。
第二个问题是我必须继续以 3 对添加对象,否则它不起作用。我似乎无法在网上找到任何合适的解决方案。