我想制作无限滑块,但它不会滑动。我该如何解决? (它停留在第一张图像上并且不会移动)
<div id="myCarousel" class="carousel slide slider" data-ride="carousel">
<ol class="carousel-indicators">
{% for slider in sliders%}
<li data-target="#myCarousel" data-slide-to="{{slider.id}}" class="{% if forloop.first%}active{%endif%}"></li>
{%endfor%}
</ol>
{% for slider in sliders%}
<div class="carousel-inner" role="listbox">
<div class="item{% if forloop.first %} active{% endif %}">
<img src="{{slider.image.url}}" alt="Chania">
<div class="carousel-caption capt">
<h1 >{{slider.caption}}</h1>
</div>
</div>
</div>
{%endfor%}
</div>
最佳答案
没有看到其他任何东西...看起来好像在不需要时复制了carousel-inner
div。相反,您应该在内部包装器中添加各个items
:
<div class="carousel-inner" role="listbox">
{% for slider in sliders%}
<div class="item{% if forloop.first %} active{% endif %}">
<img src="{{slider.image.url}}" alt="Chania">
<div class="carousel-caption capt">
<h1>{{slider.caption}}</h1>
</div>
</div>
{%endfor%}
</div>
关于javascript - Bootstrap轮播和Django,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30483186/