-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreduced-motion-empty.html
More file actions
88 lines (70 loc) · 2.12 KB
/
Copy pathreduced-motion-empty.html
File metadata and controls
88 lines (70 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reduce Motion: AccessU Accessible JavaScript</title>
<style>
body { font-family: Arial, sans-serif; margin: 0; padding: 20px; font-size:1.2em;}
button{
font-size:1rem;
border:none;
border-radius:10px;
cursor:pointer;
}
.button-scale{
background:blue;
color:white;
padding: 30px;
transition-property:padding;
transition-duration:0.5s;
}
/* CSS pseudo state will add tons of padding that we have a transition property for in the base style for the button */
.button-scale:hover{
background:black;
padding:150px;
}
.spin{
height:400px;
width:400px;
border-radius:50%;
background: linear-gradient(#fff, #000);
}
/* Adding this class to the .spin element will spin it! */
.spin-animate{
-webkit-animation:spin 4s linear infinite;
-moz-animation:spin 4s linear infinite;
animation:spin 4s linear infinite;
}
@-moz-keyframes spin {
100% { -moz-transform: rotate(360deg); }
}
@-webkit-keyframes spin {
100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
100% {
-webkit-transform: rotate(360deg);
transform:rotate(360deg);
}
}
@media(prefers-reduced-motion){
/* Write CSS media query for reduced motion - Progressive enhancement!! */
}
</style>
</head>
<body>
<h1>Reduce motion test</h1>
<button class="button-scale">This button scales on hover</button>
<details style="margin-top:200px;">
<summary>Spinning awful gradient circle </summary>
<div class="spin"></div>
</details>
<script>
const scaleButton = document.querySelector(".button-scale");
const spinDiv = document.querySelector(".spin");
// MatchMedia to sense reduce motion stored in variables
// Conditional statement to progressively enhance the .spin element with the animation
</script>
</body>
</html>