-
Notifications
You must be signed in to change notification settings - Fork 0
/
closeBtn.js
executable file
·135 lines (121 loc) · 2.99 KB
/
closeBtn.js
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
// https://codepen.io/salmanraza/pen/PpoMKb
var x = document.querySelectorAll(".closeBtnComponent");
var i;
for (i = 0; i < x.length; i++) {
const shadowRoot = x[i].attachShadow({ mode: 'open' })
shadowRoot.innerHTML = `<style>
* {
box-sizing: border-box;
}
main {
position: absolute;
top: 1%;
right: 1%;
z-index: 1000;
}
main:after {
content: 'Salman Raza';
position: absolute;
bottom: -90px;
left: 50%;
color: rgba(0, 0, 0, 0.017);
font-size: 150px;
line-height: 140px;
white-space: nowrap;
text-transform: lowercase;
transform: translateX(-50%);
pointer-events: none;
z-index: -1;
}
.sub_cnt {
display: inline-block;
background-color: #fff;
text-align: center;
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
position: relative;
margin: 0 10px 10px 0;
}
.sub_cnt:after {
position: absolute;
top: -100px;
left: 50%;
transform: translateX(-50%);
font-size: 20px;
font-family: 'Lato', sans-serif;
text-transform: uppercase;
letter-spacing: 4px;
}
.sub_cnt:nth-of-type(1):after { content: '::hover'; }
.sub_cnt:nth-of-type(2):after { content: '::focus'; }
.sub_cnt:nth-of-type(3):after { content: '::active'; }
/* Button styles */
button {
vertical-align: middle;
position: relative;
width: 80px;
height: 80px;
background-color: transparent;
overflow: hidden;
border:1px solid #333;
transition: all 0.4s ease-in-out 0s;
cursor: pointer;
}
.arrow,.arrow:after, button:after, button:before {
position: absolute;
top: 50%;
transform: translate(-50%, -50%) rotate(45deg);
left: 50%;
width: 3px;
height: 46px;
background-color: #000;
transition: all 0.4s ease-in-out 0s;
}
.arrow:after, button:after, button:before { content: ''; }
.arrow:after { transform: translate(0px, -100px); }
button:before { transform: translate(-50%, -50%) rotate(-45deg); }
button:after { transform: translate(-60px, -75px) rotate(-45deg); }
button:focus, button:focus .arrow:focus {outline: none;}
button.hover:hover:after,
button.focus:focus:after,
button.active:after
{
transform: translate(0px, -14px) rotate(-45deg);
}
button.hover:hover:before,
button.focus:focus:before,
button.active:before
{
transform: translate(60px, 45px) rotate(-45deg);
}
button.hover:hover .arrow,
button.focus:focus .arrow,
button.active .arrow
{
transform: translate(-61px, 45px) rotate(45deg);
}
button.hover:hover:after,
button.hover:hover .arrow:after,
button.focus:focus:after,
button.focus:focus .arrow:after,
button.active:after,
button.active .arrow:after
{
background-color: #fff;
}
button.hover:hover,
button.focus:focus,
button.active
{
background-color: red; border-color: red;
}
</style>
<main>
<div class="sub_cnt">
<button class="hover">
<span class="arrow"></span>
</button>
</div>
</main>
`;
}