Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EdwardNavarro/331efc7227d396f1c239589b46a446e2 to your computer and use it in GitHub Desktop.
Save EdwardNavarro/331efc7227d396f1c239589b46a446e2 to your computer and use it in GitHub Desktop.
Make Bootstrap Carousel Dynamic - Laravel 5.3
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
@foreach( $trip->photos as $photo )
<li data-target="#carousel-example-generic" data-slide-to="{{ $loop->index }}" class="{{ $loop->first ? 'active' : '' }}"></li>
@endforeach
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
@foreach( $trip->photos as $photo )
<div class="item {{ $loop->first ? ' active' : '' }}" >
<img src="{{ $photo }}" alt="{{ $trip->listing->name }}">
</div>
@endforeach
</div>
<!-- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment