Carousel

 

https://getbootstrap.com/docs/4.4/components/carousel/

 

Carousel

A slideshow component for cycling through elements—images or slides of text—like a carousel.

getbootstrap.com


JS CDN 필요

        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
        <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>

With controls

Adding in the previous and next controls:

Crossfade

Add .carousel-fade to your carousel to animate slides with a fade transition instead of a slide.

 

With captions

Add captions to your slides easily with the .carousel-caption element within any .carousel-item. They can be easily hidden on smaller viewports, as shown below, with optional display utilities. We hide them initially with .d-none and bring them back on medium-sized devices with .d-md-block.

Third slide

 


<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
        <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
        <style>

        </style>
    </head>
    <body>
        <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
            <ol class="carousel-indicators">
                <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="carousel-item active">
                    <img src="cake.jpg" class="d-block w-100">
                </div>
                <div class="carousel-item">
                    <img src="cake2.jpg" class="d-block w-100">
                </div>
                <div class="carousel-item">
                    <img src="cake3.jpg" class="d-block w-100">
                </div>
            </div>
            <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
                <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                <span class="sr-only">Previous</span>
            </a>
            <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
                <span class="carousel-control-next-icon" aria-hidden="true"></span>
                <span class="sr-only">Next</span>
            </a>
        </div>
    </body>
</html>

'디지털 컨버전스 > Java Script' 카테고리의 다른 글

[Bootstrap4] Layout : Containers  (0) 2020.04.09
[Bootstrap4] Navbar  (0) 2020.04.09
[Bootstrap4] 예제 - Card 속에 Carousel  (0) 2020.04.09
[Bootstrap4] Card  (0) 2020.04.09
[Bootstrap4] Alert , Badge  (0) 2020.04.09

+ Recent posts