twbs / bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
https://getbootstrap.com
MIT License
170.24k stars 78.77k forks source link

Carousel issues which I can't seem to fix... #7205

Closed danskionline closed 11 years ago

danskionline commented 11 years ago

Hi all,

The carousel on keycommands.info doesn't start automatically, and when it's at the end of a range of pictures, it remains clickable so that the carousel kind of disappears.

Here's my code (i took some pics out for brevity):


<div id="myCarousel" class="carousel slide">
        <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
        </ol>
    <div class="carousel-inner">
        <div class="item active">
        <a href="logic-pro-9-key-commands.php">
        <img src="img/logic-pro-9-key-commands.jpg" alt="">
            <div class="carousel-caption">
            <h4>Logic Pro 9</h4>
            <p></p>
            </div>
        </div>
        <div class="item">
        <a href="protools-10-keyboard-shortcuts.php">
        <img src="img/protools-10-shortcuts.jpg" alt="">
        </a>
            <div class="carousel-caption">
            <h4>Protools 10</h4>
            <p></p>
            </div>
        </div>
</div>

        <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>
        <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>
</div>

Can anyone spot an error?

Thanks!

kknoer commented 11 years ago

You did not end two of your anchor tags. I think it is messing with the next / prev links.

danskionline commented 11 years ago

kknoer,

thanks so much! it infinitely scrolls now, like it should (though not automatically yet)

Awesome!

kknoer commented 11 years ago

To make it scroll automatically you simply need to initiate it in a script tag or file somewhere. Like so...

$('.carousel').carousel()

danskionline commented 11 years ago

Hey kknoer,

I have this:

<script>
$(document).ready(function(){
$('.carousel').carousel({
interval: 2000
});
});
</script>

It's near the end of the body , still I'm wondering what is wrong.

Do I need to specifically call the carousel script by the way (I do) ?

Thanks for your help.

kknoer commented 11 years ago

Have you included jquery?

Sent from my iPhone

On Mar 7, 2013, at 6:01 PM, danskionline notifications@github.com wrote:

Hey kknoer,

I have this:

'''

$(document).ready(function(){ $('.carousel').carousel({ interval: 2000 }); }); '''

Still I'm wondering what is wrong.

Cheers.

— Reply to this email directly or view it on GitHub.

danskionline commented 11 years ago

Yes I have (Google).

kknoer commented 11 years ago

I viewed the source on your page. You need to put that carousel initiation code below all of your other script calls at the bottom of your page. Also, I don't believe you need that call for the bootstrap-carousel.js script as it is already compiled in the bootstrap.min.js file.

danskionline commented 11 years ago

Got it!

Works like a charm now.

Thanks a ton!

:)

kknoer commented 11 years ago

Awesome, close this issue out if you are all set.

danskionline commented 11 years ago

Done.

(github noob)

Cheers