#4 Membuat CAROUSEL atau SLIDER pada Bootstrap
Pada tutorial sebelumnya kita sudah membuat Jumbotron
untuk selanjutnya kita akan ganti jumbotron tersebut menggunakan SLIDER atau CAROUSEL pastikan sudah membuat Jumbotron
sebelum dimulai buat terlebih dahulu komentar pada jumbotron karena akan kita ganti dengan SLIDER/CAROUSEL
selanjutnya kita ke bootstrap klik CAROUSEL dan pilih sesuai kebutuhan
pada kesempatan kali ini saya akan menggunakan With indicators silahkan Copy Skrip dibawah ini :
<!doctype html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Bootstrap CSS --> <!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> --> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="js/bootstrap.min.js"> <link rel="stylesheet" type="text/css" href="style.css"> <title>Hello, world!</title> </head> <body id="page-top"> <nav class="navbar navbar-expand-lg navbar-light bg-transparan fixed-top" id="mainNav"> <div class="container"> <a class="navbar-brand font-weight-bold text-white" href="#page-top">KAMPUS DIGITAL MASA GITU</a> <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav ml-auto"> <li class="nav-item active"> <a class="nav-link text-white" href="#daftar">DAFTAR <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link js-scroll-trigger text-white" href="#download">DOWNLOAD</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle text-white" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> TUTORIAL </a> <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink"> <a class="dropdown-item" href="#">BOOTSTRAP</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="#">CODE IGNITER</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="#">LARAVEL</a> </div> </li> <li class="nav-item"> <a class="nav-link js-scroll-trigger text-white" href="#artikel">ARTIKEL</a> </li> </li> <li class="nav-item"> <a class="nav-link js-scroll-trigger text-white" href="#hubungikami">HUBUNGI KAMI</a> </li> </ul> </div> </div> </nav> <!-- <div class="jumbotron"> <div class="container"> <h1 class="display-4">RONI ANDARSYAH <br> <span class="font-weight-bold">LECTURE SERIES FOR WEBSITE</span></h1> <hr class="my-4"> <p class="lead">Kumpulan Program Tri Dharma Perguruan Tinggi.</p> <a class="btn btn-primary btn-lg font-weight-bold" href="#" role="button">SELENGKAPNYA</a> </div> </div> --> <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="images/jumbotron/16521.jpg" class="d-block w-100" alt="..."> </div> <div class="carousel-item"> <img src="images/jumbotron/456441.jpg" class="d-block w-100" alt="..."> </div> <div class="carousel-item"> <img src="images/jumbotron/pic9.jpg" class="d-block w-100" alt="..."> </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> <!-- Optional JavaScript --> <!-- jQuery first, then Popper.js, then Bootstrap JS --> <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> </body> </html>
Selanjutnya kita akan merubah ukuran SLIDER / CAROUSEL nya menggunakan file CSS yang kita gunakan pada saat membuat Jumbotron
/*Ini adalah Style SLIDER/CAROUSEL*/
.carousel-item {
height: 670px;
}
.carousel-item img{
margin-top: -350px;
}
Selanjutnya kita akan tambahkan Caption dan button pada SLIDER seperti yang sudah dibuat pada Jumbotron
<div class="carousel-caption d-none d-md-block"> <h5>First slide label</h5> <p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p> </div>
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}
.jumbotron {
background-image: url(images/jumbotron/Slider1.jpg);
background-size: cover;
height: 770px;
text-align: center;
}