2017-10-03 18:34:59 +02:00
|
|
|
<!doctype html>
|
2017-10-22 14:02:24 +02:00
|
|
|
<html lang="en">
|
2016-11-12 16:12:58 +01:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
2019-02-27 16:47:41 +01:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2020-10-22 08:38:15 +02:00
|
|
|
<link href="../../../dist/css/bootstrap.min.css" rel="stylesheet">
|
2016-11-12 16:12:58 +01:00
|
|
|
<title>Carousel</title>
|
2018-02-19 10:10:25 +01:00
|
|
|
<style>
|
|
|
|
.carousel-item {
|
|
|
|
transition: transform 2s ease, opacity .5s ease;
|
|
|
|
}
|
|
|
|
</style>
|
2016-11-12 16:12:58 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Carousel <small>Bootstrap Visual Test</small></h1>
|
2014-06-08 04:11:44 +02:00
|
|
|
|
2018-02-19 10:10:25 +01:00
|
|
|
<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>
|
2014-06-08 04:11:44 +02:00
|
|
|
|
2020-07-22 21:33:11 +02:00
|
|
|
<div id="carousel-example-generic" class="carousel slide" data-bs-ride="carousel">
|
2021-01-03 12:06:58 +01:00
|
|
|
<div class="carousel-indicators">
|
|
|
|
<button type="button" data-bs-target="#carousel-example-generic" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
|
|
|
|
<button type="button" data-bs-target="#carousel-example-generic" data-bs-slide-to="1" aria-label="Slide 2"></button>
|
|
|
|
<button type="button" data-bs-target="#carousel-example-generic" data-bs-slide-to="2" aria-label="Slide 3"></button>
|
|
|
|
</div>
|
2017-04-11 12:12:30 +02:00
|
|
|
<div class="carousel-inner">
|
2016-11-12 16:12:58 +01:00
|
|
|
<div class="carousel-item active">
|
2017-09-26 14:24:14 +02:00
|
|
|
<img src="https://i.imgur.com/iEZgY7Y.jpg" alt="First slide">
|
2016-11-12 16:12:58 +01:00
|
|
|
</div>
|
|
|
|
<div class="carousel-item">
|
2017-09-26 14:24:14 +02:00
|
|
|
<img src="https://i.imgur.com/eNWn1Xs.jpg" alt="Second slide">
|
2016-11-12 16:12:58 +01:00
|
|
|
</div>
|
|
|
|
<div class="carousel-item">
|
2017-09-26 14:24:14 +02:00
|
|
|
<img src="https://i.imgur.com/Nm7xoti.jpg" alt="Third slide">
|
2016-11-12 16:12:58 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-01-27 16:31:16 +01:00
|
|
|
<button class="carousel-control-prev" data-bs-target="#carousel-example-generic" type="button" data-bs-slide="prev">
|
2016-12-30 11:29:47 +01:00
|
|
|
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
2020-07-03 13:38:11 +02:00
|
|
|
<span class="visually-hidden">Previous</span>
|
2021-01-27 16:31:16 +01:00
|
|
|
</button>
|
|
|
|
<button class="carousel-control-next" data-bs-target="#carousel-example-generic" type="button" data-bs-slide="next">
|
2016-12-30 11:29:47 +01:00
|
|
|
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
2020-07-03 13:38:11 +02:00
|
|
|
<span class="visually-hidden">Next</span>
|
2021-01-27 16:31:16 +01:00
|
|
|
</button>
|
2014-06-08 04:11:44 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-01-30 15:12:24 +01:00
|
|
|
<script src="../../../dist/js/bootstrap.bundle.js"></script>
|
2016-11-12 16:12:58 +01:00
|
|
|
<script>
|
2022-09-22 00:48:23 +02:00
|
|
|
let t0
|
|
|
|
let t1
|
|
|
|
const carousel = document.getElementById('carousel-example-generic')
|
2018-02-19 10:10:25 +01:00
|
|
|
|
2019-02-24 14:42:18 +01:00
|
|
|
// Test to show that the carousel doesn't slide when the current tab isn't visible
|
|
|
|
// Test to show that transition-duration can be changed with css
|
2022-09-22 00:48:23 +02:00
|
|
|
carousel.addEventListener('slid.bs.carousel', event => {
|
2019-02-24 14:42:18 +01:00
|
|
|
t1 = performance.now()
|
2021-08-23 17:33:55 +02:00
|
|
|
console.log('transition-duration took ' + (t1 - t0) + 'ms, slid at ' + event.timeStamp)
|
2019-02-24 14:42:18 +01:00
|
|
|
})
|
2022-09-22 00:48:23 +02:00
|
|
|
carousel.addEventListener('slide.bs.carousel', () => {
|
2019-02-24 14:42:18 +01:00
|
|
|
t0 = performance.now()
|
2016-11-12 16:12:58 +01:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</body>
|
2014-06-08 04:11:44 +02:00
|
|
|
</html>
|