diff --git a/dist/css/bootstrap.css b/dist/css/bootstrap.css index a0cf9d2c0f7f..1081c30b90ec 100644 --- a/dist/css/bootstrap.css +++ b/dist/css/bootstrap.css @@ -5663,7 +5663,36 @@ button.close { line-height: 1; } -@media all and (transform-3d), (-webkit-transform-3d) { +@media (-webkit-transform-3d) { + .carousel-inner > .carousel-item { + -webkit-transition: -webkit-transform .6s ease-in-out; + transition: -webkit-transform .6s ease-in-out; + -o-transition: transform .6s ease-in-out, -o-transform .6s ease-in-out; + transition: transform .6s ease-in-out; + transition: transform .6s ease-in-out, -webkit-transform .6s ease-in-out, -o-transform .6s ease-in-out; + -webkit-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-perspective: 1000px; + perspective: 1000px; + } + .carousel-inner > .carousel-item.next, .carousel-inner > .carousel-item.active.right { + left: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + .carousel-inner > .carousel-item.prev, .carousel-inner > .carousel-item.active.left { + left: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + .carousel-inner > .carousel-item.next.left, .carousel-inner > .carousel-item.prev.right, .carousel-inner > .carousel-item.active { + left: 0; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@supports ((-webkit-transform: translate3d(0, 0, 0)) or (transform: translate3d(0, 0, 0))) { .carousel-inner > .carousel-item { -webkit-transition: -webkit-transform .6s ease-in-out; transition: -webkit-transform .6s ease-in-out; diff --git a/scss/_carousel.scss b/scss/_carousel.scss index 2ff886a39cbf..30f6eba36e6d 100644 --- a/scss/_carousel.scss +++ b/scss/_carousel.scss @@ -20,8 +20,8 @@ line-height: 1; } - // WebKit CSS3 transforms for supported devices - @media all and (transform-3d), (-webkit-transform-3d) { + // CSS3 transforms when supported by the browser + @include if-supports-3d-transforms() { transition: transform .6s ease-in-out; backface-visibility: hidden; perspective: 1000px; diff --git a/scss/_mixins.scss b/scss/_mixins.scss index 1b5bf0fae625..0b6fccd11271 100644 --- a/scss/_mixins.scss +++ b/scss/_mixins.scss @@ -28,6 +28,7 @@ @import "mixins/text-emphasis"; @import "mixins/text-hide"; @import "mixins/text-truncate"; +@import "mixins/transforms"; // // Components @import "mixins/alert"; diff --git a/scss/mixins/_transforms.scss b/scss/mixins/_transforms.scss new file mode 100644 index 000000000000..4005c9d028d3 --- /dev/null +++ b/scss/mixins/_transforms.scss @@ -0,0 +1,14 @@ +// Applies the given styles only when the browser support CSS3 3D transforms. +@mixin if-supports-3d-transforms() { + @media (-webkit-transform-3d) { + // Old Safari, Old Android + // http://caniuse.com/#feat=css-featurequeries + // https://developer.mozilla.org/en-US/docs/Web/CSS/@media/-webkit-transform-3d + @content; + } + + @supports (transform: translate3d(0,0,0)) { + // The Proper Way: Using a CSS feature query + @content; + } +}