Reputation: 119
I have been trying to implement this bootstrap carousel snippet, however it doesn't work properly for me. Here is the jsfiddle for my attempt. ps: I tried to import another carousel but it showed the behavior.
Here is the js associated with the snippet:
jQuery(document).ready(function($) {
$('#myCarousel').carousel({
interval: 5000
});
$('#carousel-text').html($('#slide-content-0').html());
//Handles the carousel thumbnails
$('[id^=carousel-selector-]').click( function(){
var id = this.id.substr(this.id.lastIndexOf("-") + 1);
var id = parseInt(id);
$('#myCarousel').carousel(id);
});
// When the carousel slides, auto update the text
$('#myCarousel').on('slid.bs.carousel', function (e) {
var id = $('.item.active').data('slide-number');
$('#carousel-text').html($('#slide-content-'+id).html());
});
});
Upvotes: 1
Views: 405
Reputation: 1074
You forgot to include the external resources for Bootstrap. See updated fiddle https://jsfiddle.net/cttrxkf6/1/
https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css
https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js
Upvotes: 1