|
66 | 66 | }
|
67 | 67 |
|
68 | 68 | textarea:nth-of-type(1) {
|
69 |
| - height: 130px; |
| 69 | + height: 160px; |
70 | 70 | }
|
71 | 71 |
|
72 | 72 | textarea:nth-of-type(2) {
|
|
100 | 100 |
|
101 | 101 | </style>
|
102 | 102 | <style class="editable1">
|
103 |
| - /* position: normal|sub|super */ |
104 | 103 | .container1 .lining {
|
105 | 104 | font-variant-numeric: lining-nums;
|
106 | 105 | }
|
107 | 106 | .container1 .oldstyle {
|
108 | 107 | font-variant-numeric: oldstyle-nums;
|
109 | 108 | }
|
110 |
| - .container1 .diagonal-fracs { |
111 |
| - font-variant-numeric: diagonal-fractions; |
112 |
| - } |
113 |
| - .container1 .stacked-fracs { |
114 |
| - font-variant-numeric: stacked-fractions; |
| 109 | + .inactive .container1 * { |
| 110 | + font-variant-numeric: normal; |
115 | 111 | }
|
116 | 112 | </style>
|
117 | 113 | <style class="editable2">
|
118 |
| - /* 'subs', 'sups; */ |
119 | 114 | .container2 .lining {
|
120 | 115 | font-feature-settings: 'lnum' 1;
|
121 | 116 | }
|
122 | 117 | .container2 .oldstyle {
|
123 | 118 | font-feature-settings: 'onum' 1;
|
124 | 119 | }
|
125 |
| - .container2 .diagonal-fracs { |
126 |
| - font-feature-settings: 'frac' 1; |
127 |
| - } |
128 |
| - .container2 .stacked-fracs { |
129 |
| - font-feature-settings: 'afrc' 1; |
| 120 | + .inactive .container2 * { |
| 121 | + font-feature-settings: 'lnum' 0, 'onum' 0; |
130 | 122 | }
|
131 | 123 | </style>
|
132 | 124 | </head>
|
|
136 | 128 | <div class="demo1">
|
137 | 129 | <section class="section section1">
|
138 | 130 | <div class="container container1">
|
139 |
| - <p><span class="lining">642</span> or <span class="oldstyle">642</span></p> |
140 |
| - <p><span class="diagonal-fracs">3/16</span> or <span class="stacked-fracs">1/2</span></p> |
| 131 | + <p><span class="lining">6,142</span> or <span class="oldstyle">6,142</span></p> |
141 | 132 | </div>
|
142 | 133 | </section>
|
143 | 134 | <textarea class="playable-css1">
|
144 |
| - /* position: normal|sub|super */ |
145 | 135 | .container1 .lining {
|
146 | 136 | font-variant-numeric: lining-nums;
|
147 | 137 | }
|
148 | 138 | .container1 .oldstyle {
|
149 | 139 | font-variant-numeric: oldstyle-nums;
|
150 | 140 | }
|
151 |
| - .container1 .diagonal-fracs { |
152 |
| - font-variant-numeric: diagonal-fractions; |
153 |
| - } |
154 |
| - .container1 .stacked-fracs { |
155 |
| - font-variant-numeric: stacked-fractions; |
| 141 | + .inactive .container1 * { |
| 142 | + font-variant-numeric: normal; |
156 | 143 | }
|
157 | 144 | </textarea>
|
158 | 145 | <textarea id="code1" class="playable-html1">
|
159 | 146 | <div class="container container1">
|
160 |
| - <p><span class="lining">642</span> or <span class="oldstyle">642</span></p> |
161 |
| - <p><span class="diagonal-fracs">3/16</span> or <span class="stacked-fracs">1/2</span></p> |
| 147 | + <p><span class="lining">6,142</span> or <span class="oldstyle">6,142</span></p> |
162 | 148 | </div>
|
163 | 149 | </textarea>
|
| 150 | +<input type="checkbox" name="demo1_control" id="demo1_control" value="on" checked /> <label for="demo1_control">Numeric active</label> |
164 | 151 | </div>
|
165 | 152 | <div class="demo2">
|
166 | 153 | <section class="section section2">
|
167 | 154 | <div class="container container2">
|
168 |
| - <p><span class="lining">642</span> or <span class="oldstyle">642</span></p> |
169 |
| - <p><span class="diagonal-fracs">3/16</span> or <span class="stacked-fracs">1/2</span></p> |
| 155 | + <p><span class="lining">6,142</span> or <span class="oldstyle">6,142</span></p> |
170 | 156 | </div>
|
171 | 157 | </section>
|
172 | 158 | <textarea class="playable-css2">
|
|
176 | 162 | .container2 .oldstyle {
|
177 | 163 | font-feature-settings: 'onum' 1;
|
178 | 164 | }
|
179 |
| - .container2 .diagonal-fracs { |
180 |
| - font-feature-settings: 'frac' 1; |
181 |
| - } |
182 |
| - .container2 .stacked-fracs { |
183 |
| - font-feature-settings: 'afrc' 1; |
| 165 | + .inactive .container2 * { |
| 166 | + font-feature-settings: 'lnum' 0, 'onum' 0; |
184 | 167 | }
|
185 | 168 | </textarea>
|
186 | 169 | <textarea id="code2" class="playable-html2">
|
187 | 170 | <div class="container container2">
|
188 |
| - <p><span class="lining">642</span> or <span class="oldstyle">642</span></p> |
189 |
| - <p><span class="diagonal-fracs">3/16</span> or <span class="stacked-fracs">1/2</span></p> |
| 171 | + <p><span class="lining">6,142</span> or <span class="oldstyle">6,142</span></p> |
190 | 172 | </div>
|
191 | 173 | </textarea>
|
| 174 | +<input type="checkbox" name="demo2_control" id="demo2_control" value="on" checked /> <label for="demo2_control">Numeric active</label> |
192 | 175 | </div>
|
193 | 176 | </div>
|
194 | 177 | <div class="playable-buttons">
|
|
210 | 193 | var cssCode1 = textareaCSS1.value;
|
211 | 194 | var htmlCode2 = textareaHTML2.value;
|
212 | 195 | var cssCode2 = textareaCSS2.value;
|
| 196 | + var demo1_active = document.getElementById('demo1_control'); |
| 197 | + var demo2_active = document.getElementById('demo2_control'); |
| 198 | + |
| 199 | + demo1_active.addEventListener('change', function () { |
| 200 | + if (this.checked) { |
| 201 | + this.parentNode.classList.remove('inactive'); |
| 202 | + } else { |
| 203 | + this.parentNode.classList.add('inactive'); |
| 204 | + } |
| 205 | + }); |
| 206 | + |
| 207 | + demo2_active.addEventListener('change', function () { |
| 208 | + if (this.checked) { |
| 209 | + this.parentNode.classList.remove('inactive'); |
| 210 | + } else { |
| 211 | + this.parentNode.classList.add('inactive'); |
| 212 | + } |
| 213 | + }); |
213 | 214 |
|
214 | 215 | function fillCode() {
|
215 | 216 | editable1.innerHTML = textareaCSS1.value;
|
|
223 | 224 | textareaCSS1.value = cssCode1;
|
224 | 225 | textareaHTML2.value = htmlCode2;
|
225 | 226 | textareaCSS2.value = cssCode2;
|
| 227 | + demo1_active.checked = true; |
| 228 | + demo1_active.parentNode.classList.remove('inactive'); |
| 229 | + demo2_active.checked = true; |
| 230 | + demo2_active.parentNode.classList.remove('inactive'); |
226 | 231 | fillCode();
|
227 | 232 | });
|
228 | 233 |
|
|
0 commit comments