Ahoj lidi,

Používám vezi bootstrapu 4.1.

Našel jsem co hledám, ale je to z verze 2.3.2, zde odkaz:

Bootstrap ELM8oORAoZ

Zde mám kod , který používám a se kterým mi prostě nereaguje od řádku var to slide:

Kód:
    $(".carousel-item:first").attr("id", "0");
         $(".carousel-item:first:nth-child(1)").attr("id", "1");
          $(".carousel-item:nth-child(2)").attr("id", "2");
           $(".carousel-item:last").attr("id", "3"); 
         
          
   
  
   $(".carousel").on("slide.bs.carousel", function () {
      
  
    $(".cs-slide.active").removeClass("active");
    
    
      
    $(".carousel").on("slid.bs.carousel", function () {
      
      var to_slide = $(".carousel-item.active").attr("id");	
   		
      $(".nav .cs-slide-link a [data-slide-to=" + to_slide + "]").addClass("active");
      
  	 });
   });
Takhle vypadá položka menu:

Kód:
            <ul id="navigace" class="nav cs-navigation">
                            <?php if ( $rs['nav1link'] != '' ) { ?> 
                                <li class="cs-slide-link ">
                                <a class="cs-slide active" data-target="#carouselExampleControls" data-slide-to="0" href="#" ><?php echo ($rs['nav1']);?></a>   
                                </li>
                            <?php } ?>
                            <?php if ( $rs['nav2link'] != '' ) { ?>     
                                <li class="cs-slide-link">
                                     <a class="cs-slide" data-target="#carouselExampleControls" data-slide-to="1" href="#" ><?php echo ($rs['nav2']);?></a>  
                                </li>
                            <?php } ?>
                            <?php if ( $rs['nav3link'] != '' ) { ?> 
                                <li class="cs-slide-link">
                                     <a  class="cs-slide" data-target="#carouselExampleControls" data-slide-to="2" href="#" ><?php echo ($rs['nav3']);?></a>  
                                </li>
                            <?php } ?>
                            <?php if ( $rs['nav4link'] != '' ) { ?> 
                                <li class="cs-slide-link">
                                     <a class="cs-slide" data-target="#carouselExampleControls" data-slide-to="3" href="#" ><?php echo ($rs['nav4']);?></a>  
                                </li>
                            <?php } ?>  
                            <?php if ( $rs['nav5link'] != '' ) { ?> 
                                <li class="cs-slide-link">
                                 
                                    <a class="cs-slide" href="<?php echo ($rs['nav5link']);?>"><?php echo ($rs['nav5']);?></a>
                               
                                </li>
                            <?php } ?>
                        </ul>
Takhle carousel:

Kód:
    
<div id="carouselExampleControls" class="carousel slide carousel-fade" data-ride="carousel">
           
           
             <!-- Indicators -->
  <ul class="carousel-indicators rounded">
    <li data-target="#carouselExampleControls" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleControls" data-slide-to="1"></li>
    <li data-target="#carouselExampleControls" data-slide-to="2"></li>
    <li data-target="#carouselExampleControls" data-slide-to="3"></li>
  </ul>
           
           
            <div class="carousel-inner"> 
           <?php
            $sql = "SELECT * FROM directory WHERE status = 'P' ORDER BY postid ASC ";
            $result = $DB->prepare($sql);  
            $result->execute();    
            // Zobrazenie slideov 
            while ($rs = $result->fetch(PDO::FETCH_ASSOC)) { ?>
     
    
      
      

            
            
           
        <div class="carousel-item"  data-target="#carouselExampleControls">
          <img class="d-block w-100" src="/css/img/obrazky/<?php echo stripslashes($rs['image']); ?>" alt="First slide">
           <div class="directory-view <?php echo ($rs['position']); ?>">
                <h2 class="directory-heading"><a href="<?php echo ($rs['buttonlink']); ?>"><?php echo stripslashes($rs['title']); ?></a></h2>
                <br>
                <span class="directory-button"><a href="<?php echo ($rs['buttonlink']); ?>"><?php echo stripslashes($rs['buttontext']); ?></a></span>
                <br>
            </div>
       
      <div class="directory-view <?php echo ($rs['position']); ?>">
                <h2 class="directory-heading"><a href="<?php echo ($rs['buttonlink']); ?>"><?php echo stripslashes($rs['title']); ?></a></h2>
                <br>
                <span class="directory-button"><a href="<?php echo ($rs['buttonlink']); ?>"><?php echo stripslashes($rs['buttontext']); ?></a></span>
                <br>
            </div>  
       
     
      
      
         
  <a class="carousel-control-prev" href="#carouselExampleControls" 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="#carouselExampleControls" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
      
      </div>
Předem díky za radu... tenhle kod mi tam vůbec nereaguje, dyžtak bych mohl udělat nějakou zkoušečku pro bootstrap 4.1. Ale nemělo by to být o tolik jiné ne ?

---------- Příspěvek doplněn 08.11.2018 v 12:50 ----------

Tady je odpověď, kdyby někdo chtěl, ať to vlákno k něčemu je.

javascript - Carousel with tabs: adjust active tab when carousel slides to next…