我有一个问题,因为我无法发现一些小错误,导致我的轮播无法正常工作。我将代码发布在这里,任何帮助将不胜感激。
{# templates/home/home_page.html #}
{% extends "base.html" %}
{% load wagtailcore_tags wagtailimages_tags %}
{% block content %}
{% image self.banner_image width-3560 as img %}
<div class="jumbotron" style="background-image: url('{{ img.url }}'); min-height: 400px; height: 40vh; background-size: cover; background-position: center top; display: flex; flex-direction: column; justify-content: center;">
<h1 class="display-4">{{ self.banner_title }}</h1>
<div class="lead">{{ self.banner_subtitle|richtext }}</div>
{% if self.banner_cta %}
<a class="btn btn-primary btn-lg" href="#" role="button">@todo</a>
{% endif %}
</div>
{# Example of an Orderable from home/models.py #}
<div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
{% for loop_cycle in self.carousel_images.all %}
{% image loop_cycle.carousel_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>
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
{% for block in page.content %}
{% include_block block %}
{% endfor %}
{% endblock %}
如果我没记错的话,这取自How to use Orderables in Wagtail CMS,无论如何,我想说您是否在base.html中添加了引导CDN链接?无论如何,由于您只在此处提供代码,因此很难提供任何建议。
谢谢
灰