【问题标题】:Having a bootstrap carousel for Wagtail problem有一个用于 Wagtail 问题的引导轮播
【发布时间】:2019-10-24 10:26:43
【问题描述】:

我一直在测试我的代码并遇到了一个小问题。我在底部的指示器允许导航,但要到达轮播中的最终图像,我需要单击倒数第二个指示器?我看不到错误:(。其他所有工作正常。

  <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
        <ul class="carousel-indicators">
            {% for item in page.blogpage_images.all %}
                    <li data-target="#carouselExampleIndicators" data-slide-to="{{ forloop.counter }}" 
                                    class="{% if forloop.counter == 1 %}active{% endif %}"></li>
            {% endfor %}
        </ul>
        <div class="carousel-inner">
            {% for item in page.blogpage_images.all %}
                {% image item.image fill-900x400 as img %}
                <div class="carousel-item {% if forloop.counter == 1 %}active{% endif %}">
                    <img src="{{ img.url }}" class="d-block w-100" alt="{{ img.alt }}">
                </div>


            {% endfor %}
        </div>
    </div>

编辑:我得到了答案,但删除问题没有意义!

【问题讨论】:

    标签: python html django wagtail


    【解决方案1】:

    {{ forloop.counter|add:"-1" }} 中的data-slide-to

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-08
      • 2015-12-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多