在我的春季靴子百里香中,以下代码是滑块不能很好地工作。结果在图像中显示。 该代码有什么问题。请检查一下。
<ol class="carousel-indicators">
<th:block th:each="picture, iterstat : ${package.picture}">
<li data-target="#jsaAboutCarousel" th:attr="data-slide-to=${iterstat.index}" th:class="${iterstat.index}== 0 ? 'active':''"></li>
</th:block>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div th:each="picture, iterstat : ${package.picture}">
<th:block th:class="${iterstat.index}== 0 ? 'item':'item active'">
<img th:src="@{${baseurl}+'/backend/getPackageImagePath/' + ${picture}}" class="img-responsive" />
</th:block>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#jsaAboutCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#jsaAboutCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
答案 0 :(得分:0)
我认为您无法在class
代码中添加th:block
属性。
<div class="carousel-inner">
<div th:each="picture, iterstat : ${package.picture}">
<th:block th:class="${iterstat.index}== 0 ? 'item':'item active'">
<img th:src="@{${baseurl}+'/backend/getPackageImagePath/' + ${picture}}" class="img-responsive" />
</th:block>
</div>
</div>
尝试改变这样。
<div class="carousel-inner">
<div th:each="picture, iterstat : ${package.picture}" th:class="${iterstat.index}== 0 ? 'item':'item active'">
<img th:src="@{${baseurl}+'/backend/getPackageImagePath/' + ${picture}}" class="img-responsive" />
</div>
</div>