carousel.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. {% assign limit = include.limit | default: 5 %}
  2. {% assign offset = include.offset | default: 0 %}
  3. {% assign photos = site.data.photos | where: "horizontal", true %}
  4. {% assign id = include.id | default: "carousel" %}
  5. <div id="{{ id }}" class="carousel slide{% if include.fade %} carousel-fade{% endif %}" data-bs-ride="carousel">
  6. {% if include.indicators %}
  7. <div class="carousel-indicators{% if include.indicators-vertical %} carousel-indicators-vertical{% endif %}{% if include.indicators-dot %} carousel-indicators-dot{% elsif include.indicators-thumb %} carousel-indicators-thumb{% endif %}">
  8. {% for photo in photos limit: limit offset: offset %}
  9. <button type="button" data-bs-target="#{{ id }}" data-bs-slide-to="{{ forloop.index | minus: 1 }}" class="{%if include.indicators-thumb-ratio %} ratio ratio-4x3{% endif %}{% if forloop.first %} active{% endif %}"{% if include.indicators-thumb %} style="background-image: url({{ site.base }}/static/photos/{{ photo.file }})"{% endif %}></button>
  10. {% endfor %}
  11. </div>
  12. {% endif %}
  13. <div class="carousel-inner">
  14. {% for photo in photos limit: limit offset: offset %}
  15. <div class="carousel-item{% if forloop.first %} active{% endif %}">
  16. <img class="d-block w-100" alt="" src="{{ site.base }}/static/photos/{{ photo.file }}">
  17. {% if include.captions %}
  18. <div class="carousel-caption-background d-none d-md-block"></div>
  19. <div class="carousel-caption d-none d-md-block">
  20. <h3>Slide label</h3>
  21. <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
  22. </div>
  23. {% endif %}
  24. </div>
  25. {% endfor %}
  26. </div>
  27. {% if include.controls %}
  28. <a class="carousel-control-prev" href="#{{ id }}" role="button" data-bs-slide="prev">
  29. <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  30. <span class="visually-hidden">Previous</span>
  31. </a>
  32. <a class="carousel-control-next" href="#{{ id }}" role="button" data-bs-slide="next">
  33. <span class="carousel-control-next-icon" aria-hidden="true"></span>
  34. <span class="visually-hidden">Next</span>
  35. </a>
  36. {% endif %}
  37. </div>