I'm facing an issue with an image carousel where I want each picture to maintain the same size regardless of its dimensions. Currently, the carousel keeps changing sizes and I can't seem to figure out why.
Any assistance on this matter would be highly appreciated!
HTML:
<!-- Image Carousel -->
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<!-- Slider -->
<div class="row-fluid">
<div class="span9" id="slider">
<!-- Top part of the slider -->
<div class="row-fluid">
<div class="span2" id="carousel-bounding-box">
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item" data-slide-number="0"><img id="pic1" src="{% static 'images/pic01.jpg' %}" class="img-thumbnail" height="300" width="300"></div>
<div class="item" data-slide-number="1"><img id="pic2" src="{% static 'images/pic01.jpg' %}" class="img-thumbnail" height="300" width="300"></div>
<div class="item" data-slide-number="2"><img id="pic3" src="{% static 'images/pic01.jpg' %}" class="img-thumbnail" height="300" width="300"></div>
<div class="item" data-slide-number="3"><img id="pic4" src="{% static 'images/pic01.jpg' %}" class="img-thumbnail" height="300" width="300"></div>
<div class="item" data-slide-number="4"><img id="pic5" src="{% static 'images/pic01.jpg' %}" class="img-thumbnail" height="300" width="300"></div>
</div>
</div>
<!-- Carousel nav -->
<div class="carousel-controls-mini">
<a href="#myCarousel" data-slide="prev">‹</a>
<a href="#myCarousel" data-slide="next">›</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Image Carousel -->
CSS:
.carousel-inner img {
width:250px;
height:250px;
}
#myCarousel {
font-size:90%;
}
.carousel-controls-mini {
}
.carousel-controls-mini > a {
border:1px solid #eee;
width:20px;
display:block;
float:left;
text-align:center;
}
Javascript:
$('#myCarousel').carousel({
interval: 5000
});
$('#carousel-text').html($('#slide-content-0').html());
//Handles the carousel thumbnails
$('[id^=carousel-selector-]').click( function(){
var id_selector = $(this).attr("id");
var id = id_selector.substr(id_selector.length-1);
var id = parseInt(id);
$('#myCarousel').carousel(id);
});
// When the carousel slides, auto update the text
$('#myCarousel').on('slid', function (e) {
var id = $('.item.active').data('slide-number');
$('#carousel-text').html($('#slide-content-'+id).html());
});
Thank you, Chris