-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (121 loc) · 3.22 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[DEMO] slideToggle (@ht-devx)</title>
<link rel="shortcut icon" href="https://64.media.tumblr.com/b00fee68465863c268372a663550cfcc/e94b8e8f6699419d-21/s128x128u_c1/cf70565652033104ab21b7291301c6313a16d649.pnj">
</head>
<body>
<!----- 【 slideToggle: @ht-devx 】 ----->
<link href="./slideToggle.css" rel="stylesheet">
<script src="./slideToggle.js"></script>
<!------------------------------------->
<script>
slideToggle({
trigger: ".button[data-id='1']",
content: ".content[data-id='1']"
})
slideToggle({
trigger: ".button[data-id='2']",
content: ".content[data-id='2']"
})
</script>
<!------------------------------------->
<style>
/* fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
:root {
--SlideToggle-Speed-1:500ms;
--SlideToggle-Speed-2:1s;
}
body {
margin:0;
font-family:"Instrument Sans", sans-serif;
font-size:0.9rem;
color:#5f646d;
line-height:1.6;
}
main {
position:fixed;
width:100%;
height:100%;
display:flex;
align-items:center;
justify-content:center;
}
.main-inner {
display:flex;
flex-direction:column;
align-items:center;
width:clamp(25vw, 380px, 85vw);
}
button:not(:first-child){
margin-top:1rem;
}
button {
padding:0.65rem 0.8rem;
border-radius:4px;
font-family:"Poppins";
font-weight:500;
font-size:0.8rem;
text-transform:uppercase;
letter-spacing:0.015em;
outline:none;
color:#51555d;
line-height:1;
cursor:pointer;
}
button[data-id="1"]{
border:2px solid #a9be8e;
background:#c2d4aa;
}
button[data-id="2"]{
border:2px solid #b6a27c;
background:#d4c5aa;
}
.content:not(:first-child) .content-inner {
margin-top:1rem;
}
.content-inner {
padding:0.65rem 0.8rem;
border:1px solid #ecedef;
background:#f6f7f8;
border-radius:4px;
color:#6b6f7b;
}
.content:not(.slidetoggle-content){
display:none;
}
</style>
<!------------------------------------->
<main>
<div class="main-inner">
<!---- BUTTON 1 ---->
<button class="button" data-id="1">
I'm button 1
</button>
<!---- CONTENT 1 ---->
<section class="content" data-id="1">
<div class="content-inner">
I'm the stuff that button 1 reveals!
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at posuere urna. Aenean id arcu eu ante vulputate lobortis id vitae massa. Cras posuere dolor at mi venenatis interdum.
</div>
</section>
<!---- BUTTON 2 ---->
<button class="button" data-id="2">
I'm button 2
</button>
<!---- CONTENT 2 ---->
<section class="content" data-id="2">
<div class="content-inner">
I'm the stuff that button 2 reveals!
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras interdum gravida tellus, a fringilla tortor venenatis nec. Maecenas fermentum nunc id malesuada viverra. Mauris tempor convallis varius. Nunc interdum nibh id sem porttitor, et egestas lorem fermentum. Sed accumsan luctus eleifend.
</div>
</section>
</div><!--main-inner-->
</main>
</body>
</html>