1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-22 05:03:16 +02:00

Fix JS components console error "Error: <Component> is transitioning"

This commit is contained in:
Pierre Vanduynslager
2017-03-28 17:43:16 -04:00
committed by Johann-S
parent ce0e2f8e76
commit 48c5efa4c3
16 changed files with 101 additions and 155 deletions

View File

@@ -45,31 +45,11 @@
<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 () {
$(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) {
$('#carousel-example-generic').on('slid.bs.carousel', function(event) {
console.log('slid at ', event.timeStamp)
})
testCarouselTransitionError()
})
</script>
</body>