Skip to content

Commit 49b83f2

Browse files
committed
Adding fallback warning to title slide.
1 parent 1ae9541 commit 49b83f2

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

css/main.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ span.active {
817817
bottom: 32%;
818818
right: 19%;
819819
}
820-
#s1 h2 span {
820+
.csstransforms3d #s1 h2 span {
821821
-webkit-transition: 0.6s;
822822
-moz-transition: 0.6s;
823823
-ms-transition: 0.6s;
@@ -834,6 +834,17 @@ span.active {
834834
-o-transform-style: preserve-3d;
835835
transform-style: preserve-3d;
836836
}
837+
#s1 .warning {
838+
opacity: 0;
839+
width: 100%;
840+
height: 100%;
841+
color: #a00;
842+
text-align: center;
843+
background: url('/img/bad-time.jpg?1359756760') no-repeat 10% 70%;
844+
}
845+
.no-csstransforms3d #s1 .warning.active {
846+
opacity: 1;
847+
}
837848

838849
/*
839850
* Slide 2: Our friend, the DOM Element

img/bad-time.jpg

105 KB
Loading

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ <h1>
3636
</h1>
3737
<h2><span>Exploring CSS 3D Transforms</span></h2>
3838

39+
<div class="warning">
40+
<p>Darn, your browser seems unable to display 3D Transforms.</p>
41+
</div>
42+
3943
</article>
4044
<article id="s2">
4145

js/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"$('.ox, .m', '#s1').toggleClass('active'); ",
1717
"$('.odel', '#s1').toggleClass('active'); ",
1818
"$('h2 span', '#s1').toggleClass('active'); ",
19+
"$('.no-csstransforms3d #s1 .warning').toggleClass('active'); ",
1920

2021
// Slide 2
2122
"scrollTo('#s2');",
@@ -131,6 +132,7 @@
131132
"$('.ox, .m', '#s1').toggleClass('active'); ",
132133
"$('.odel', '#s1').toggleClass('active'); ",
133134
"$('h2 span', '#s1').toggleClass('active'); ",
135+
"$('.no-csstransforms3d #s1 .warning').toggleClass('active'); ",
134136

135137
// Slide 2
136138
"scrollTo('#s1');",

sass/partials/slides/_s1.scss

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,32 @@
4545
}
4646
}
4747

48-
// "Exploring CSS 3D Transforms"
48+
// Exploring CSS 3D Transforms
4949
h2 {
5050
font-size: 3em / $slide-font-size;
5151
position: absolute;
5252
bottom: 32%;
5353
right: 19%;
5454

55-
span {
55+
.csstransforms3d & span {
5656
@include transition(.6s);
5757
@include transform(rotateY(16deg) translateX(-5.2em) translateY(-1.8em) translateZ(14em));
5858
@include transform-style(preserve-3d);
5959
}
6060
}
61+
62+
// This warning is for browsers that don't support 3D transforms
63+
.warning {
64+
opacity: 0; // hidden by default
65+
width: 100%;
66+
height: 100%;
67+
color: #a00;
68+
text-align: center;
69+
background: image-url('bad-time.jpg') no-repeat 10% 70%;
70+
}
71+
72+
// Show warning for browsers that fail Modernizr test
73+
.no-csstransforms3d & .warning.active {
74+
opacity: 1;
75+
}
6176
}

0 commit comments

Comments
 (0)