123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Blasting off with Bootstrap</title>
- <meta charset="utf-8"/>
- <meta http-equiv="X-UA-COMPATIBLE" content="IE=Edge"/>
- <meta name="viewport" content="width=device-width, initial-scale=1"/>
- <link rel="stylesheet" href="../css/bootstrap.min.css"/>
- <!--[if lt IE 9]>
- <script src="../js/html5shiv.3-7-0.js"></script>
- <script src="../js/respond.1-4-2.min.js"></script>
- <![endif]-->
- <style type="text/css">
- img {
- height: 50vh !important;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div id="bestCarsCarousel" class="carousel slide" data-ride="carousel">
- <!-- Indicators -->
- <ol class="carousel-indicators">
- <li data-target="#bestCarsCarousel" data-slide-to="0" class="active"></li>
- <li data-target="#bestCarsCarousel" data-slide-to="1"></li>
- <li data-target="#bestCarsCarousel" data-slide-to="2"></li>
- </ol>
- <!-- Wrapper for slides -->
- <div class="carousel-inner">
- <div class="item active">
- <img src="images/car1.jpg" class="img-circle center-block" />
- <div class="carousel-caption">
- <h3>Concept-car Alfa-Romeo</h3>
- <p>Lorem ipsum dolor sic amet, consectetur ...</p>
- </div>
- </div>
- <div class="item">
- <img src="images/car2.jpg" class="img-circle center-block" />
- <div class="carousel-caption">
- <h3>Concept-car Honda</h3>
- <p>Lorem ipsum dolor sic amet, consectetur ...</p>
- </div>
- </div>
- <div class="item">
- <img src="images/car3.jpg" class="img-circle center-block" />
- <div class="carousel-caption">
- <h3>Concept-car Chrysler BMW</h3>
- <p>Lorem ipsum dolor sic amet, consectetur ...</p>
- </div>
- </div>
- <!-- Controls -->
- <a href="#bestCarsCarousel" class="left carousel-control" data-slide="prev">
- <span class="glyphicon glyphicon-chevron-left"></span>
- </a>
- <a href="#bestCarsCarousel" class="right carousel-control" data-slide="next">
- <span class="glyphicon glyphicon-chevron-right"></span>
- </a>
- </div>
- </div>
- </div>
- <!-- https://ajax.googleapis.com/ajax/libs/jquery/1.11.1.jquery.min.js -->
- <script src="../js/jquery-1.11.2.min.js"></script>
- <script src="../js/bootstrap.js"></script>
- <script type="text/javascript">
- var options = {
- interval: 3000,
- // Stop sliding on hover. Default: no
- pause: "hover",
- // Continue to first after last
- wrap: true
- }
- function getImage(j) {
- var ret;
- ret = $(j).find('.item.active').children('img')[0].getAttribute('src');
- return ret;
- }
- /* Or carousel(command) where command in:
- - cycle : enable cycling
- - pause cycling
- - <number> time duration between slides
- - prev change to previous slide
- - next change to next slide
- */
- $('#bestCarsCarousel').carousel(options);
- $('#bestCarsCarousel').on('slide.bs.carousel', function() {
- console.log("Sliding out", getImage(this));
- });
- $('#bestCarsCarousel').on('slid.bs.carousel', function() {
- var src = getImage(this);
- console.log("Slid in", getImage(this));
- });
- </script>
- </body>
- </html>
|