-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
57 lines (57 loc) · 1.36 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
<!DOCTYPE html>
<html lang="en"><head>
<head>
<title>Zero Width Space</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<button class="copy">Click Here to Copy</button>
<style>
html, body {
margin:0;
padding:0;
width:100%;
height:100%;
background-color:#ffffff;
}
.copy {
margin:0;
padding:0;
width:100%;
height:100%;
cursor:pointer;
border:none;
font-size:24px;
transition-duration:0.4s;
background-color:#2B3340;
color:#33CC99;
}
.copy:hover {
background-color:#2B3340;
color:#33CC99;
opacity:0.9;
}
.copy:active:focus {
background-color:#33CC99;
color:#33CC99;
}
</style>
<script>
var body = document.body;
body.style.width = document.documentElement.clientWidth;
body.style.height = document.documentElement.clientHeight;
console.log(window.width);
console.log(window.height);
var button = document.querySelector(".copy");
button.addEventListener("click", function(){
var dummy = document.createElement('textarea');
dummy.value = '';
document.body.appendChild(dummy);
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
button.innerText = "Copied!"
});
</script>
</body>
</html>