Skip to content

Commit 02a3238

Browse files
committed
Moves oblique demo
1 parent 1892a18 commit 02a3238

File tree

4 files changed

+160
-0
lines changed

4 files changed

+160
-0
lines changed

assets/playable.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var section = document.querySelector('section');
2+
var editable = document.querySelector('.editable');
3+
var textareaHTML = document.querySelector('.playable-html');
4+
var textareaCSS = document.querySelector('.playable-css');
5+
var reset = document.getElementById('reset');
6+
var htmlCode = textareaHTML.value;
7+
var cssCode = textareaCSS.value;
8+
9+
let editorHeading = document.createElement("h4");
10+
editorHeading.innerHTML = "Interactive editor";
11+
document.querySelector('body').insertBefore(editorHeading,textareaCSS);
12+
13+
function fillCode() {
14+
editable.innerHTML = textareaCSS.value;
15+
section.innerHTML = textareaHTML.value;
16+
}
17+
18+
reset.addEventListener('click', function () {
19+
textareaHTML.value = htmlCode;
20+
textareaCSS.value = cssCode;
21+
fillCode();
22+
});
23+
24+
25+
textareaHTML.addEventListener('input', fillCode);
26+
textareaCSS.addEventListener('input', fillCode);
27+
window.addEventListener('load', fillCode);

assets/styles.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* Some default styling for cookbook examples */
2+
/*
3+
rgb(53,43,34)
4+
rgb(75,70,74)
5+
rgb(95,97,110)
6+
rgb(137,151,188)
7+
rgb(160,178,226)
8+
*/
9+
body {
10+
background-color: #fff;
11+
color: #333;
12+
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
13+
padding: 0;
14+
margin: 0;
15+
}
16+
17+
/* styles for the editor */
18+
19+
.playable {
20+
font-family: monospace;
21+
display: block;
22+
margin-bottom: 10px;
23+
background-color: #F4F7F8;
24+
border: none;
25+
border-left: 6px solid #558ABB;
26+
color: #4D4E53;
27+
width: 90%;
28+
max-width: 700px;
29+
padding: 10px 10px 0px;
30+
font-size: 90%;
31+
}
32+
33+
.playable-css {
34+
height: 80px;
35+
}
36+
37+
.playable-html {
38+
height: 160px;
39+
}
40+
41+
.playable-buttons {
42+
text-align: right;
43+
width: 90%;
44+
max-width: 700px;
45+
padding: 5px 10px 5px 26px;
46+
font-size: 100%;
47+
}
48+
49+
.preview {
50+
width: 90%;
51+
max-width: 700px;
52+
border: 1px solid #4D4E53;
53+
border-radius: 2px;
54+
padding: 10px 14px 10px 10px;
55+
margin-bottom: 10px;
56+
}
57+
58+
.preview input {
59+
display: block;
60+
margin: 5px;
61+
}
145 KB
Binary file not shown.

variable-fonts/oblique.html

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Variable fonts: oblique</title>
6+
<link rel="stylesheet" href="../assets/styles.css" />
7+
<style>
8+
9+
10+
11+
</style>
12+
13+
<style class="editable">
14+
15+
@font-face {
16+
src: url('fonts/AmstelvarAlpha-VF.ttf');
17+
font-family:'AmstelvarAlpha';
18+
font-style: normal;
19+
}
20+
21+
label {
22+
font: 1rem monospace;
23+
}
24+
25+
26+
.sample {
27+
font: 2rem 'AmstelvarAlpha', sans-serif;
28+
font-variation-settings: 'slnt' 14;
29+
font-style: oblique 23deg;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
<section class="preview">
36+
37+
<div class="container">
38+
<p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p>
39+
</div>
40+
41+
</section>
42+
43+
<textarea class="playable playable-css" style="height: 280px;">
44+
@font-face {
45+
src: url('fonts/AmstelvarAlpha-VF.ttf');
46+
font-family:'AmstelvarAlpha';
47+
font-style: normal;
48+
}
49+
50+
label {
51+
font: 1rem monospace;
52+
}
53+
54+
.sample {
55+
font: 2rem 'AmstelvarAlpha', sans-serif;
56+
font-style: oblique 23deg;
57+
}
58+
</textarea>
59+
60+
<textarea class="playable playable-html" style="height: 130px;">
61+
<div class="container">
62+
<p class="sample">...it would not be wonderful to meet a Megalosaurus, forty feet long or so, waddling like an elephantine lizard up Holborn Hill.</p>
63+
</div>
64+
</textarea>
65+
66+
<div class="playable-buttons">
67+
<input id="reset" type="button" value="Reset" />
68+
</div>
69+
</body>
70+
71+
<script src="../assets/playable.js"></script>
72+
</html>

0 commit comments

Comments
 (0)