number of items in bootstrap carousel
I tried adding six images into bootstrap carousel using the JavaScript code below:
<script>
!function ($) {
$(function(){
// carousel demo
$('#myCarousel').carousel({number:6})
})
}(window.jQuery)
</script>
The images on the web page looks distorted. Could you please help out?
You forgot to include the JS?
I did include the js at the bottom of the page -
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-alert.js"></script>
<script src="assets/js/bootstrap-modal.js"></script>
<script src="assets/js/bootstrap-dropdown.js"></script>
<script src="assets/js/bootstrap-scrollspy.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script src="assets/js/bootstrap-tooltip.js"></script>
<script src="assets/js/bootstrap-popover.js"></script>
<script src="assets/js/bootstrap-button.js"></script>
<script src="assets/js/bootstrap-collapse.js"></script>
<script src="assets/js/bootstrap-carousel.js"></script>
<script src="assets/js/bootstrap-typeahead.js"></script>
No, I mean your initial post said "using the JavaScript code below", but doesn't have any JavaScript code in it.
Sorry! Here it is
<script>
!function ($) {
$(function(){
// carousel demo
$('#myCarousel').carousel({number:6})
})
}(window.jQuery)
</script>
No, it's not.
I posted it again and it is automatically taken off each time I submit it.
Here it is -
On Wed, Jun 26, 2013 at 4:56 PM, Chris Rebert [email protected]:
No, I mean your initial post said "using the JavaScript code below", but doesn't have any JavaScript code in it.
— Reply to this email directly or view it on GitHubhttps://github.com/twitter/bootstrap/issues/8312#issuecomment-20058541 .
Each time I click on the comment button, the script automatically disappears. I sent through an email.
Thanks.
Carousel's options object has no number key. You seem to be confusing it with $(...).carousel(N), where N is an integer, but that isn't related to your goal.
Am stuck! what is the way out?
On Wed, Jun 26, 2013 at 5:10 PM, Chris Rebert [email protected]:
Carousel's options object has no number key. You seem to be confusing it with $(...).carousel(N), where N is an integer, but that isn't related to your goal.
— Reply to this email directly or view it on GitHubhttps://github.com/twitter/bootstrap/issues/8312#issuecomment-20059657 .
Have you tried simply adding .items under .carousel-inner ?
Yes I did but the items didn't render well, they were all distorted. I added five six items (pictures) initially but when I reduced it to three, it rendered well on the web page.
Please make an online example, maybe using something like http://jsfiddle.net/
Else it's close to impossible to guess our way to a soloution
http://zodml.org/responsive/test.php - this is the sample of the file that am working at the moment. I placed six images in the carousel and the web page gets distorted but when I leave only three in the carousel, the page looks fine again. Is it that three items is the default items that go into the bootstrap carousel?
Seems to work fine, see http://jsfiddle.net/cCRHF/
What do you mean by images get distorted?
View the image attached to see what I meant with the carousel on the web page being distorted.
It's because you have elements inside the carousel missing the .item on them?
<div><img title="Junior Secondary Reading Programme" src="http://zodml.org/images/carousel_jsrp1.png" alt="Junior Secondary Reading Programme" width="550" height="300" /></div>
should be
<div class="item"><img title="Junior Secondary Reading Programme" src="http://zodml.org/images/carousel_jsrp1.png" alt="Junior Secondary Reading Programme" width="550" height="300" /></div>
Thanks so much! I didn't even spot that, whewww!
I added the "class="item" into the div holding the images.
Thanks once again.
Great! This is good to close.