-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpopup.html
101 lines (89 loc) · 2.76 KB
/
popup.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
width: 200px;
height: 100px;
background-color: rgb(73, 71, 60)!important;
}
input[type="checkbox"] {
position: absolute;
visibility: hidden;
}
label {
display: block;
position: absolute;
width: 60px;
height: 34px;
border-radius: 17px;
background-color: #ddd;
transition-duration: 0.2s;
}
label span {
position: absolute;
left: 3px;
top: 3px;
z-index: 1;
width: 28px;
height: 28px;
border-radius: 50%;
background-color: #fff;
transition-duration: 0.2s;
}
label:before,
label:after{
position: absolute;
top: 0;
width: 34px;
font-size: 11px;
line-height: 34px;
color: #fff;
text-align: center;
}
label:before {
left: 0;
content: 'ON';
}
label:after {
right: 0;
content: 'OFF';
}
input:checked + label {
background-color: #00c73c;
}
input:checked + label span {
transform: translateX(26px);
}
</style>
</head>
<body>
<table>
<tr>
<td>
다크모드 적용
</td>
<td>
<input type="checkbox" id="checkbox" onchange="change(this)">
<label for="checkbox"><span></span></label>
</td>
</tr>
</table>
<script type="text/javascript">
function change(chkbox) {
if(chkbox.checked == true) {
setDarkmode1();
}
}
function setDarkmode1() {
var link = document.createElement( "link" );
link.href = "darkStyle1.css";
link.type = "text/css";
link.rel = "stylesheet";
link.media = "screen,print";
document.getElementsByTagName( "head" )[0].appendChild( link );
}
</script>
</body>
</html>