Trying to get a carousel inside a carousel

Viewed 155

I'm trying to make a carousel inside a carousel so I can dynamically load larger sections and have everything neatly organized, I am trying to hardcode a carousel inside a carousel for the time being however I am having issues with the third slide not displaying and I cant figure out why does anyone have any suggestions.

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
    <style>
        /* Make the image fully responsive */
        .carousel-inner img {
            width: 25%;
            height: 25%;
        }
    </style>
</head>
<body>

<div id="demo1" class="carousel slide" data-ride="carousel" data-interval="false">

    <!-- Indicators -->
    <ul class="carousel-indicators">
        <li data-target="#demo1" data-slide-to="0" class="active"></li>
        <li data-target="#demo1" data-slide-to="1"></li>
        <li data-target="#demo1" data-slide-to="2"></li>
    </ul>

    <!-- The slideshow -->
    <div class="carousel-inner text-center" style="background-color: #3a3b45">
        <div class="carousel-item active">
            <img src="img/logo.png" alt="Los Angeles">
        </div>
        <div class="carousel-item">
            <!--Carousel 2-->
            <!--<img src="img/logo.png" alt="Los Angeles">-->
            <div id="demo2" class="carousel slide" data-ride="carousel" data-interval="false">

                <ul class="carousel-indicators mb-4">
                    <li data-target="#demo2" data-slide-to="0" class="active"></li>
                    <li data-target="#demo2" data-slide-to="1"></li>
                    <li data-target="#demo2" data-slide-to="2"></li>
                </ul>

                <div class="carousel-inner">
                    <div class="carousel-item active">
                        <img src="img/logo.png" alt="Los Angeles">
                    </div>
                    <div class="carousel-item">
                        <img src="img/logo.png" alt="Chicago">
                    </div>
                    <div class="carousel-item">
                        <img src="img/logo.png" alt="New York">
                    </div>
                </div>
            </div>
            <!--Carousel 2 END-->
        </div>
        <div class="carousel-item">
            <img src="img/logo.png" alt="New York">
        </div>
    </div>

    <!-- Left and right controls -->
    <a class="carousel-control-prev" href="#demo1" data-slide="prev">
        <span class="carousel-control-prev-icon"></span>
    </a>
    <a class="carousel-control-next" href="#demo1" data-slide="next">
        <span class="carousel-control-next-icon"></span>
    </a>

</div>

</body>
</html>
1 Answers

Although it's mentioned in the documentation of bootstrap 4 that-

nested carousels are not supported

enter image description here

But, I'm trying, I wanted to do this a long time ago & now seeing your question made me re-try, I'll let you know here if I make it, till then you can start where I stopped today- (visit the link in the comment)

Best of luck.

Related