我需要一个轮播,每个幻灯片显示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个对象,否则将不起作用。 我似乎在网上找不到任何合适的解决方案。