carousel.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">
  7. <title>Carousel</title>
  8. <style>
  9. .carousel-item {
  10. transition: transform 2s ease, opacity .5s ease;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <div class="container">
  16. <h1>Carousel <small>Bootstrap Visual Test</small></h1>
  17. <p>The transition duration should be around 2s. Also, the carousel shouldn't slide when its window/tab is hidden. Check the console log.</p>
  18. <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  19. <ol class="carousel-indicators">
  20. <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
  21. <li data-target="#carousel-example-generic" data-slide-to="1"></li>
  22. <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  23. </ol>
  24. <div class="carousel-inner">
  25. <div class="carousel-item active">
  26. <img src="https://i.imgur.com/iEZgY7Y.jpg" alt="First slide">
  27. </div>
  28. <div class="carousel-item">
  29. <img src="https://i.imgur.com/eNWn1Xs.jpg" alt="Second slide">
  30. </div>
  31. <div class="carousel-item">
  32. <img src="https://i.imgur.com/Nm7xoti.jpg" alt="Third slide">
  33. </div>
  34. </div>
  35. <a class="carousel-control-prev" href="#carousel-example-generic" role="button" data-slide="prev">
  36. <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  37. <span class="sr-only">Previous</span>
  38. </a>
  39. <a class="carousel-control-next" href="#carousel-example-generic" role="button" data-slide="next">
  40. <span class="carousel-control-next-icon" aria-hidden="true"></span>
  41. <span class="sr-only">Next</span>
  42. </a>
  43. </div>
  44. </div>
  45. <script src="../../../node_modules/jquery/dist/jquery.slim.min.js"></script>
  46. <script src="../../dist/util.js"></script>
  47. <script src="../../dist/carousel.js"></script>
  48. <script>
  49. $(function() {
  50. var t0, t1;
  51. // Test to show that the carousel doesn't slide when the current tab isn't visible
  52. // Test to show that transition-duration can be changed with css
  53. $('#carousel-example-generic').on('slid.bs.carousel', function(event) {
  54. t1 = performance.now()
  55. console.log('transition-duration took' + (t1 - t0) + 'ms, slid at ', event.timeStamp)
  56. }).on('slide.bs.carousel', function() {
  57. t0 = performance.now()
  58. })
  59. })
  60. </script>
  61. </body>
  62. </html>