How is the view.blade.php that loads the data for a carousel bootstrap?

0

I'm trying to load the data dynamically from a mySql database, into a carousel bootstrap, with laravel 5.3. The following is happening: The data is loaded, but the carousel does not work, that is, it stays static, with one image over the other. I believe it's a problem in the view, which follows the code for better perception. Thank you in advance.

View home.blade.php

<div id="carousel-example-generic" class="carousel slide carousel-home" data-ride="carousel">


         <!-- Indicators -->
    <ol class="carousel-indicators">
        @foreach($noticia as $notic)
            {{--<li data-target="#carousel-example-generic" data-slide-to="{{$i}}"></li>--}}
            <li data-target="#carouselExampleIndicators" data-slide-to="{{ $loop->index }}" class="{{ $loop->first ? 'active' : '' }}"></li>
        @endforeach
    </ol>

    <!-- Wrapper for slides -->
    <div class="carousel-inner" role="listbox">
        @foreach($noticia as $item)
            <div class="carousel-item {{ $loop->first ? 'active' : '' }}">
                <img src="{{$item->imagem}}" alt="...">
                <div class="carousel-caption" style="background-color: rgba(4,162,183,0.9)">
                    <p><h3>{{$item->titulo}}</h3></p>
                </div>
            </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>

Result

    
asked by anonymous 07.04.2018 / 01:31

1 answer

0

I found the solution !!! The problem was in this line:

<div class="carousel-item {{ $loop->first ? 'active' : '' }}">

The correct one is:

<div class="item {{ $loop->first ? 'active' : '' }}">

Removing carousel -

    
07.04.2018 / 15:44