Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
652 views
in Technique[技术] by (71.8m points)

image - How do I add a links to pictures in Twitter Bootstrap Carousel?

I want to make the pictures that scroll through the carousel. Also, when we click on them, they open the Hyperlink.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Simply, envelope images with href tag. So, if we modify the example of the official documentation:

<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="http://estiloasertivo.blogspot.com.es/"> 
                <img src="http://lh5.ggpht.com/-tNlXRzR4qMw/ThaowBgad2I/AAAAAAAAD6I/OEd6kbouBvk/s1600-h/chapi%25255B4%25255D.png" alt="">

                <div class="carousel-caption">
                    <h4>First Thumbnail label</h4>
                    <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam.
                        Donec id elit non mi porta gravida at eget metus. Nullam id dolor
                        id nibh ultricies vehicula ut id elit.</p>
                </div>
            </a>
        </div>
        <div class="item">
            <a href="http://www.youtube.com/watch?v=Ehv0iriLTKE"> 
                <img src="http://www.chistosos.com.mx/wp-content/uploads/2012/07/perro-gracioso-en-coche-aire-chistosa.jpg" alt="">

                <div class="carousel-caption">
                    <h4>Second Thumbnail label</h4>
                    <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam.
                        Donec id elit non mi porta gravida at eget metus. Nullam id dolor
                        id nibh ultricies vehicula ut id elit.</p>
                </div>
            </a>
        </div>
        <div class="item">
            <a href="http://www.google.cn/">
                <img src="http://www.theandrewblog.net/wp-content/uploads/2012/04/ant.jpg"  alt="">

                <div class="carousel-caption">
                    <h4>Third Thumbnail label</h4>
                    <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam.
                        Donec id elit non mi porta gravida at eget metus. Nullam id dolor
                        id nibh ultricies vehicula ut id elit.</p>
                </div>
            </a>
        </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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...