Skip to content

Commit 62c7484

Browse files
feat(demo): Add demo.html for local testing
This commit adds a `demo.html` file to showcase the animated `hide()` functionality. This allows for easy local testing and verification of the feature.
1 parent 449dfec commit 62c7484

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

demo.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
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>
37+
38+
<script src="lib/rough-notation.iife.js"></script>
39+
<script>
40+
const { annotate } = RoughNotation;
41+
42+
const el = document.getElementById('annotated-text');
43+
const annotation = annotate(el, { type: 'underline', color: 'red', animationDuration: 1000 });
44+
45+
el.addEventListener('click', () => {
46+
if (annotation.isShowing()) {
47+
annotation.hide();
48+
} else {
49+
annotation.show();
50+
}
51+
});
52+
53+
// Initially show the annotation
54+
annotation.show();
55+
</script>
56+
57+
</body>
58+
</html>

0 commit comments

Comments
 (0)