Skip to content

Commit

Permalink
Add @supports feature query for Carousel CSS 3D transforms; fixes #15534
Browse files Browse the repository at this point in the history
 (#19751)

[skip sauce]
[skip validator]
  • Loading branch information
cvrebert authored and mdo committed Nov 25, 2016
1 parent 3cfd407 commit 3593ee8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
31 changes: 30 additions & 1 deletion dist/css/bootstrap.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scss/_carousel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@import "mixins/text-emphasis";
@import "mixins/text-hide";
@import "mixins/text-truncate";
@import "mixins/transforms";
@import "mixins/visibility";

// // Components
Expand Down
14 changes: 14 additions & 0 deletions scss/mixins/_transforms.scss
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 3593ee8

Please sign in to comment.