|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <html> |
3 | | -<head> |
4 | | - <title>Rough Notation Demo</title> |
5 | | - <style> |
6 | | - body { |
7 | | - font-family: sans-serif; |
8 | | - display: flex; |
9 | | - flex-direction: column; |
10 | | - align-items: center; |
11 | | - justify-content: center; |
12 | | - height: 100vh; |
13 | | - margin: 0; |
14 | | - } |
15 | | - #annotated-text { |
16 | | - font-size: 2em; |
17 | | - padding: 20px; |
18 | | - border: 1px solid #ccc; |
19 | | - cursor: pointer; |
20 | | - } |
21 | | - .instructions { |
22 | | - margin-top: 20px; |
23 | | - font-size: 1em; |
24 | | - color: #555; |
25 | | - } |
26 | | - </style> |
27 | | -</head> |
28 | | -<body> |
29 | | - |
30 | | - <div id="annotated-text"> |
31 | | - Click me to toggle the annotation. |
32 | | - </div> |
33 | | - |
34 | | - <div class="instructions"> |
35 | | - This demo shows the animated `hide()` method. |
36 | | - </div> |
| 3 | + <head> |
| 4 | + <title>Rough Notation Demo</title> |
| 5 | + <style> |
| 6 | + body { |
| 7 | + font-family: sans-serif; |
| 8 | + display: flex; |
| 9 | + flex-direction: column; |
| 10 | + align-items: center; |
| 11 | + justify-content: center; |
| 12 | + height: 100vh; |
| 13 | + margin: 0; |
| 14 | + } |
| 15 | + #annotated-text { |
| 16 | + font-size: 2em; |
| 17 | + padding: 20px; |
| 18 | + border: 1px solid #ccc; |
| 19 | + cursor: pointer; |
| 20 | + } |
| 21 | + .instructions { |
| 22 | + margin-top: 20px; |
| 23 | + font-size: 1em; |
| 24 | + color: #555; |
| 25 | + } |
| 26 | + </style> |
| 27 | + </head> |
| 28 | + <body> |
| 29 | + <div id="annotated-text">Click me to toggle the annotation.</div> |
37 | 30 |
|
38 | | - <script src="lib/rough-notation.iife.js"></script> |
39 | | - <script> |
40 | | - const { annotate } = RoughNotation; |
| 31 | + <div class="instructions"> |
| 32 | + This demo shows the animated `hide()` method. |
| 33 | + </div> |
41 | 34 |
|
42 | | - const el = document.getElementById('annotated-text'); |
43 | | - const annotation = annotate(el, { type: 'underline', color: 'red', animationDuration: 1000 }); |
| 35 | + <script src="lib/rough-notation.iife.js"></script> |
| 36 | + <script> |
| 37 | + const { annotate } = RoughNotation; |
44 | 38 |
|
45 | | - el.addEventListener('click', () => { |
46 | | - if (annotation.isShowing()) { |
47 | | - annotation.hide(); |
48 | | - } else { |
49 | | - annotation.show(); |
50 | | - } |
51 | | - }); |
| 39 | + const el = document.getElementById("annotated-text"); |
| 40 | + const annotation = annotate(el, { |
| 41 | + type: "underline", |
| 42 | + color: "red", |
| 43 | + animationDuration: 1000, |
| 44 | + animateOnHide: true, |
| 45 | + }); |
52 | 46 |
|
53 | | - // Initially show the annotation |
54 | | - annotation.show(); |
55 | | - </script> |
| 47 | + el.addEventListener("click", () => { |
| 48 | + if (annotation.isShowing()) { |
| 49 | + annotation.hide(); |
| 50 | + } else { |
| 51 | + annotation.show(); |
| 52 | + } |
| 53 | + }); |
56 | 54 |
|
57 | | -</body> |
| 55 | + // Initially show the annotation |
| 56 | + annotation.show(); |
| 57 | + </script> |
| 58 | + </body> |
58 | 59 | </html> |
0 commit comments