Skip to content Skip to sidebar Skip to footer

Bootstrap Carousel JQuery Error

I'm trying to make a multiple items bootstrap carousel but it gives me this error: '#Carousel'.carousel is not a function TypeError: '#Carousel'.carousel is not a function, how can

Solution 1:

From the code you pasted, I cannot see that you are loading Bootstrap library (css and js code). You can see Bootstrap loading information here http://getbootstrap.com/getting-started/


Solution 2:

A full description of Carousel component is reported in boostrap 4.

In this page, instead, you will find the required libraries.

Working code:

$(document).ready(function () {
    $('#Carousel').carousel({
        interval: 8000
    })
});
.carousel-control {
    left: -12px;
    height: 40px;
    width: 40px;
    background: none repeat scroll 0 0 #222222;
    border: 4px solid #FFFFFF;
    border-radius: 23px 23px 23px 23px;
    margin-top: 90px;
}
.carousel-control.right {
    right: -12px;
}
.carousel-indicators {
    right: 50%;
    top: auto;
    bottom: -10px;
    margin-right: -19px;
}
.carousel-indicators li {
    background: #cecece;
}
.carousel-indicators .active {
    background: #428bca;
}
<link  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>

<div class="row">
    <div class="col-md-12">
        <div id="Carousel" class="carousel slide">
            <ol class="carousel-indicators">
                <li data-target="#Carousel" data-slide-to="0" class="active"></li>
                <li data-target="#Carousel" data-slide-to="1"></li>
                <li data-target="#Carousel" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="carousel-item item active">
                    <div class="row">
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                    </div>
                </div>
                <div class="carousel-item item">
                    <div class="row">
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                    </div>
                </div>
                <div class="carousel-item item">
                    <div class="row">
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                        <div class="col-md-3">
                            <a href="#" class="thumbnail"><img src="http://placehold.it/250x250" alt="Image" style="max-width:100%;"></a>
                        </div>
                    </div>
                </div>
            </div>
            <a data-slide="prev" href="#Carousel" class="left carousel-control"></a> <a data-slide="next" href="#Carousel" class="right carousel-control"></a> </div>
    </div>
</div>

Post a Comment for "Bootstrap Carousel JQuery Error"