O
O
opsimecom2021-02-20 01:29:06
PHP
opsimecom, 2021-02-20 01:29:06

Carousel photo how to do?

Hello! There is a code

<?php
      while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
      <div class="col-sm-12 card2 card-body card-blog card-border mb-4 card-teaser  col-md-6 col-lg-4 col-xl-3">
          
      <?php
        if($row['product_video_link'] == '0'):
      ?>
       
        <div> 
        
        
          <div id="sliderBigImages" class="carousel slide" data-ride="carousel">
    <div class="carousel-inner">
        <div class="carousel-item active">
            <img src="https://275129.selcdn.ru/macaw/<?=$row['product_image_link']?>" alt="" style="width: 100%;">
        </div>
        <div class="carousel-item">
            <img src="https://275129.selcdn.ru/macaw/193728d2f5bb9d2cf8f7.jpeg" class="d-block w-100" alt="Природа">
        </div>
        <div class="carousel-item">
           <img src="https://275129.selcdn.ru/macaw/<?=$row['product_image_link']?>" alt="" style="width: 100%;">
        </div>
    </div>
    <a class="carousel-control-prev" href="#sliderBigImages" 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="#sliderBigImages" role="button" data-slide="next">
        <span class="carousel-control-next-icon" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
        
    </a>
</div>

it creates a lot of frames with pictures, I want the carousel to work on all frames when uploading a photo, but right now it only works on one, that is, it appears on all, but switching works only on one. I sin on this (sliderBigImages) how to make my own carousel work for all frames?

Each frame has its own unique code from the database,
<?=$row['product_id']?>how to tie it all up correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniel, 2021-02-20
@daniil46

<div id="sliderBigImages<?=$row['product_id']?>" class="carousel slide" data-ride="carousel">

<a class="carousel-control-prev" href="#sliderBigImages<?=$row['product_id']?>" role="button" data-slide="prev">    </a>
<a class="carousel-control-next" href="#sliderBigImages<?=$row['product_id']?>" role="button" data-slide="next">   </a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question