python - 为 Wagtail 问题提供引导轮播

标签 python html django wagtail

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

  <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>

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

最佳答案

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

关于python - 为 Wagtail 问题提供引导轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58539332/

相关文章:

python - 在单独的进程组挂起中运行 Fabric 命令

python - GCP Bigquery 未提供错误流中的所有不良记录

python - 如何从 Python 列表中返回匹配项

jquery - 在图像上单击打开覆盖文本字段的弹出窗口/模式

python - django 测试覆盖率与黑盒测试?

python - 如何在 Python 中将 Azure Blob 文件 CSV 转换为 Excel

html - 事件日期的最佳 UI 是什么?

html - 使用@font-face

python - Django View 集没有属性 'get_extra_actions'

python - Django + Foursquare OAuth + 用户登录