bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

number of items in bootstrap carousel

Open Ehis-Anthony opened this issue 13 years ago • 18 comments

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?

Ehis-Anthony avatar Jun 26 '13 12:06 Ehis-Anthony

You forgot to include the JS?

cvrebert avatar Jun 26 '13 15:06 cvrebert

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>

Ehis-Anthony avatar Jun 26 '13 15:06 Ehis-Anthony

No, I mean your initial post said "using the JavaScript code below", but doesn't have any JavaScript code in it.

cvrebert avatar Jun 26 '13 15:06 cvrebert

Sorry! Here it is

<script>
      !function ($) {
        $(function(){
          // carousel demo
          $('#myCarousel').carousel({number:6})
        })
      }(window.jQuery)
    </script>

Ehis-Anthony avatar Jun 26 '13 15:06 Ehis-Anthony

No, it's not.

juthilo avatar Jun 26 '13 16:06 juthilo

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 .

Ehis-Anthony avatar Jun 26 '13 16:06 Ehis-Anthony

Each time I click on the comment button, the script automatically disappears. I sent through an email.

Thanks.

Ehis-Anthony avatar Jun 26 '13 16:06 Ehis-Anthony

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.

cvrebert avatar Jun 26 '13 16:06 cvrebert

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 .

Ehis-Anthony avatar Jun 26 '13 16:06 Ehis-Anthony

Have you tried simply adding .items under .carousel-inner ?

cvrebert avatar Jun 26 '13 16:06 cvrebert

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.

Ehis-Anthony avatar Jun 27 '13 08:06 Ehis-Anthony

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

Marcohj avatar Jun 27 '13 09:06 Marcohj

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?

Ehis-Anthony avatar Jun 27 '13 15:06 Ehis-Anthony

Seems to work fine, see http://jsfiddle.net/cCRHF/

What do you mean by images get distorted?

Marcohj avatar Jun 27 '13 15:06 Marcohj

distorted View the image attached to see what I meant with the carousel on the web page being distorted.

Ehis-Anthony avatar Jun 27 '13 15:06 Ehis-Anthony

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>

Marcohj avatar Jun 27 '13 15:06 Marcohj

Thanks so much! I didn't even spot that, whewww!

I added the "class="item" into the div holding the images.

Thanks once again.

Ehis-Anthony avatar Jun 27 '13 16:06 Ehis-Anthony

Great! This is good to close.

juthilo avatar Jun 27 '13 20:06 juthilo