V
V
Vadim Anghel2018-08-29 14:32:26
PHP
Vadim Anghel, 2018-08-29 14:32:26

How to make bootstrap carousele with youtube images and videos?

It is not possible to make video and photos in one image carousel.
photos and videos will be from the db
, I made it just to show images

<div id="carouselExampleIndicators" class="carousel slide " data-ride="carousel" >
      <ol class="carousel-indicators">
        @foreach( $galleries as $photo )
           <li data-target="#carouselExampleIndicators" data-slide-to="{{ $photo->id }}" class="{{ $photo->first ? 'active' : '' }}"></li>
        @endforeach
      </ol>

      <div class="carousel-inner" >
        @foreach( $galleries as $photo )
          <div class="carousel-item {{ $loop->first ? 'active' : '' }}" id="carouselemobile">
              <img class="d-block w-100 img-fluid" src="images/galerie/{{$photo->filename}}" alt="{{ $photo->id }}" style="height: 650px; width: 50%;">
          </div>
          @endforeach
      </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

everything works but you need to take turns and video and photos!
who can help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2018-08-30
@BorisKorobkov

$photo = reset($photos);
$video = reset($videos);
while ($photo && $video ) {
   echo ...
   $photo = next($photos);
   $video = next($videos);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question