Last active
January 19, 2017 15:56
-
-
Save janstieler/6679145 to your computer and use it in GitHub Desktop.
A snippet code for Bootstraps 3 Carousel for the KirbyCMS with Numbers.
Disable the round indicators by CSS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="carousel-example-generic" class="carousel slide"> | |
<!-- Indicators --> | |
<ol class="carousel-indicators"> | |
<?php $n=0; foreach($page->images() as $image): ?> | |
<li data-target="#carousel-example-generic" data-slide-to="<?php echo $n; $n++; ?>" class="<?php if($n==1) echo ' active' ?>"> | |
<!-- Show a Number for the Indicator --> | |
<?php echo $n; ?> | |
</li> | |
<?php endforeach ?> | |
</ol> | |
<!-- Wrapper for slides --> | |
<div class="carousel-inner"> | |
<?php $n=0; foreach($page->images() as $image): $n++; ?> | |
<div class="item<?php if($n==1) echo ' active' ?>"> | |
<img src="<?php echo $image->url() ?>" alt="<?php echo html($image->title()) ?>" class="img-responsive" /> | |
<div class="carousel-caption"> | |
<?php echo kirbytext($image->caption()) ?> | |
</div> | |
</div> | |
<?php endforeach ?> | |
</div> | |
<!-- Controls --> | |
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"> | |
<span class="icon-prev"></span> | |
</a> | |
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"> | |
<span class="icon-next"></span> | |
</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment