-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (75 loc) · 2.5 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>modal.js</title>
<script src="./modal.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
const modal = new Modal(document.getElementById("modalWin"));
modal.shadow = true;
document.getElementById("btn").addEventListener("click", function () {
modal.show();
});
document.getElementById("modalWin").addEventListener("click", function () {
modal.hide();
});
});
</script>
<style>
body {
margin: 0;
background-color: wheat;
font-family: sans-serif;
}
main {
box-sizing: border-box;
max-width: 800px;
min-height: 100vh;
margin: 0 auto;
border-left: 1px solid gray;
border-right: 1px solid gray;
padding: 1em;
box-shadow: 1px 1px 3px 1px gray;
background-color: white;
}
#modalWin {
width: 30vw;
height: 30vh;
border: 1px solid gray;
background-color: white;
border-radius: 0.5em;
box-shadow: 1px 1px 3px 1px gray;
text-align: center;
}
pre{
overflow-x: auto;
}
</style>
</head>
<body>
<main>
<h1>Modal.js</h1>
<p>次のようなコードで要素をモーダルウィンドウにできます。
<code><pre>
// インスタンス生成
const modal = new Modal(document.getElementById("ID-of-element"));
// 影をつける場合
modal.shadow = true;
// モーダルウィンドウを開く
modal.show();
// モーダルウィンドウを閉じる
modal.hide();
</pre></code>
</p>
<p><input type="button" id="btn" value="ここ">をクリックするとサンプルが開きます。</p>
<p>その他の情報は、<a href="https://github.com/18t2003g/modal.js">https://github.com/18t2003g/modal.js</a>を参照してください。</p>
<p><a href="./index_en.html">English page</a></p>
</main>
<div id="modalWin">
<p>これはサンプルです</p>
<p>クリックすると閉じます</p>
</div>
</body>
</html>