django carousal不工作

时间:2017-12-06 06:25:22

标签: django carousel

我花了两天时间试图在我的网站上修理carousal。由于我是django的新手,我设法从bootstrap cdn获取导航栏但无法在浏览器中加载carousal。请帮忙

这是我的base.html看起来像

<!--Carousal-slider-->
            <main role= "main">
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                  <!-- Indicators-->

                  <ol class="carousel-indicators">
                    {% for item in slider %}
                    <li data-target="#carousel-example-generic" data-slide-to="{{ item.id }}" class="{% if forloop.first %}active{% endif %}"></li>
                    {% endfor %}

                  </ol>

                  <!-- Wrapper for slides -->

                  <div class="carousel-inner" role="listbox">
                    {% for item in slider %}
                    <div class="item{% if forloop.first  %} active {% endif %}">
                      {% if item.slider %}<img src="{{ item.slider_image.url }}" alt="test">{% endif %}
                      <div class="carousel-caption">
                        {% if item.display_title %}<h3>{{ item.display_title }}</h3>{% endif %}
                        {{ item.display_content|safe }}
                      </div>
                    </div>
                  <!-- <div class="item">
                      <img src="..." alt="...">
                      <div class="carousel-caption">
                        ...
                      </div>
                    </div>
                    ... -->
                 </div>
                  {%endfor%}

                  <!-- Controls -->


                  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                  </a>
                  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                  </a>
            </div>
        </main>

    </body>

在查看我的网站的源代码后,看起来像我提到的旋转木马没有从文件夹中取出我的图像。这就是它的样子

<!--Carousal-slider-->
            <main role= "main">
            <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                  <!-- Indicators-->

                  <ol class="carousel-indicators">


                  </ol>

                  <!-- Wrapper for slides -->

                  <div class="carousel-inner" role="listbox">


                  <!-- Controls -->


                  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                    <span class="sr-only">Previous</span>
                  </a>
                  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                    <span class="sr-only">Next</span>
                  </a>
            </div>
        </main>

0 个答案:

没有答案