mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
297c47c3fd
* Throw error when a plugin is in transition * Add unit tests about plugins in transition
78 lines
3.0 KiB
HTML
78 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<link rel="stylesheet" href="../../../dist/css/bootstrap.min.css">
|
|
<title>Carousel</title>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Carousel <small>Bootstrap Visual Test</small></h1>
|
|
|
|
<p>Also, the carousel shouldn't slide when its window/tab is hidden. Check the console log.</p>
|
|
|
|
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
|
|
<ol class="carousel-indicators">
|
|
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
|
|
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
|
|
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
|
|
</ol>
|
|
<div class="carousel-inner" role="listbox">
|
|
<div class="carousel-item active">
|
|
<img src="https://37.media.tumblr.com/tumblr_m8tay0JcfG1qa42jro1_1280.jpg" alt="First slide">
|
|
</div>
|
|
<div class="carousel-item">
|
|
<img src="https://37.media.tumblr.com/tumblr_m8tazfiVYJ1qa42jro1_1280.jpg" alt="Second slide">
|
|
</div>
|
|
<div class="carousel-item">
|
|
<img src="https://38.media.tumblr.com/tumblr_m8tb2rVsD31qa42jro1_1280.jpg" alt="Third slide">
|
|
</div>
|
|
</div>
|
|
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
|
|
<span class="icon-prev" aria-hidden="true"></span>
|
|
<span class="sr-only">Previous</span>
|
|
</a>
|
|
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
|
|
<span class="icon-next" aria-hidden="true"></span>
|
|
<span class="sr-only">Next</span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="../vendor/jquery.min.js"></script>
|
|
<script src="../../dist/util.js"></script>
|
|
<script src="../../dist/carousel.js"></script>
|
|
|
|
<script>
|
|
// Should throw an error because carousel is in transition
|
|
function testCarouselTransitionError() {
|
|
var err = false
|
|
var $carousel = $('#carousel-example-generic')
|
|
$carousel.on('slid.bs.carousel', function () {
|
|
$carousel.off('slid.bs.carousel')
|
|
if (!err) {
|
|
alert('No error thrown for : testCarouselTransitionError')
|
|
}
|
|
})
|
|
try {
|
|
$carousel.carousel('next').carousel('prev')
|
|
}
|
|
catch (e) {
|
|
err = true
|
|
console.error(e.message)
|
|
}
|
|
}
|
|
|
|
$(function () {
|
|
// Test to show that the carousel doesn't slide when the current tab isn't visible
|
|
$('#carousel-example-generic').on('slid.bs.carousel', function (event) {
|
|
console.log('slid at ', event.timeStamp)
|
|
})
|
|
testCarouselTransitionError()
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|