Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created November 27, 2018 18:39
Show Gist options
  • Save benmcnelly/8c07d4f965d707b9081311b407678825 to your computer and use it in GitHub Desktop.
Save benmcnelly/8c07d4f965d707b9081311b407678825 to your computer and use it in GitHub Desktop.
Bootstrap Carousel
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
{% if advertisment %}
{% for s in advertisment %}
<li data-target="#carouselExampleIndicators" data-slide-to="{{ forloop.counter0 }}" {% if forloop.first %} class="active" {% endif %}></li>
{% endfor %}
{% endif %}
</ol>
<div class="carousel-inner">
{% if advertisment %}
{% for a in advertisment %}
<div class="carousel-item {% if forloop.first %} active {% endif %} ">
{% if a.link %}
<a {% if internal_ad == No %} {{ internal_ad }} target="_blank" {% endif %} href="{{ a.link }}"><img width="1540" class="d-block w-100" src="{{ a.ad_image.url }}" alt="{{ a.description }}"></a>
{% else %}
<img class="d-block w-100" width="1540" src="{{ a.ad_image.url }}" alt="{{ a.description }}">
{% endif %}
</div>
{% endfor %}
{% endif %}
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" 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="#carouselExampleIndicators" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment