-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path404.html
More file actions
175 lines (162 loc) · 6.17 KB
/
404.html
File metadata and controls
175 lines (162 loc) · 6.17 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404 Not Found</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f8f8f8;
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
box-sizing: border-box;
}
.container {
text-align: center;
max-width: 600px;
width: 100%;
position: relative;
}
h1 {
font-size: 2.5em;
color: #333;
margin: 0.5em 0;
}
p {
font-size: 1.2em;
color: #666;
margin: 0.5em 0;
}
img {
max-width: 100%;
height: auto;
}
.dot {
position: absolute;
width: 12px;
height: 12px;
background-color: #44dbc2;
border: 2px solid #fff;
border-radius: 50%;
cursor: pointer;
}
.redirect-button {
margin-top: 20px;
padding: 10px 20px;
font-size: 2em;
color: #2c3135;
background-color: #6f64e8;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<img id="interactiveSvg" src="assets/svgs/404.svg" alt="404 Not Found">
<div class="dot" id="top-left"></div>
<div class="dot" id="top-right"></div>
<div class="dot" id="bottom-left"></div>
<div class="dot" id="bottom-right"></div>
<h1>404 Not Found</h1>
<p>The page you are looking for does not exist.</p>
<button class="redirect-button" onclick="redirectToRoot()">Go to Home</button>
</div>
<script>
const svgElement = document.getElementById('interactiveSvg');
const dots = {
'top-left': document.getElementById('top-left'),
'top-right': document.getElementById('top-right'),
'bottom-left': document.getElementById('bottom-left'),
'bottom-right': document.getElementById('bottom-right')
};
const h1Element = document.querySelector('h1');
const pElement = document.querySelector('p');
function updateDots() {
const rect = svgElement.getBoundingClientRect();
dots['top-left'].style.left = `${rect.left - 6}px`;
dots['top-left'].style.top = `${rect.top - 6}px`;
dots['top-right'].style.left = `${rect.right - 6}px`;
dots['top-right'].style.top = `${rect.top - 6}px`;
dots['bottom-left'].style.left = `${rect.left - 6}px`;
dots['bottom-left'].style.top = `${rect.bottom - 6}px`;
dots['bottom-right'].style.left = `${rect.right - 6}px`;
dots['bottom-right'].style.top = `${rect.bottom - 6}px`;
}
function resizeText() {
const rect = svgElement.getBoundingClientRect();
const scaleFactor = rect.width / 600; // Assuming 600px is the original width
h1Element.style.fontSize = `${2.5 * scaleFactor}em`;
pElement.style.fontSize = `${1.2 * scaleFactor}em`;
}
function makeResizable(dot, onDrag) {
let isDragging = false;
const startDrag = () => {
isDragging = true;
document.addEventListener('mousemove', onDrag);
document.addEventListener('touchmove', onDrag);
document.addEventListener('mouseup', endDrag);
document.addEventListener('touchend', endDrag);
};
const endDrag = () => {
isDragging = false;
document.removeEventListener('mousemove', onDrag);
document.removeEventListener('touchmove', onDrag);
};
dot.addEventListener('mousedown', startDrag);
dot.addEventListener('touchstart', startDrag);
}
makeResizable(dots['top-left'], (e) => {
const rect = svgElement.getBoundingClientRect();
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
svgElement.style.width = `${rect.right - clientX}px`;
svgElement.style.height = `${rect.bottom - clientY}px`;
updateDots();
resizeText();
});
makeResizable(dots['top-right'], (e) => {
const rect = svgElement.getBoundingClientRect();
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
svgElement.style.width = `${clientX - rect.left}px`;
svgElement.style.height = `${rect.bottom - clientY}px`;
updateDots();
resizeText();
});
makeResizable(dots['bottom-left'], (e) => {
const rect = svgElement.getBoundingClientRect();
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
svgElement.style.width = `${rect.right - clientX}px`;
svgElement.style.height = `${clientY - rect.top}px`;
updateDots();
resizeText();
});
makeResizable(dots['bottom-right'], (e) => {
const rect = svgElement.getBoundingClientRect();
const clientX = e.touches ? e.touches[0].clientX : e.clientX;
const clientY = e.touches ? e.touches[0].clientY : e.clientY;
svgElement.style.width = `${clientX - rect.left}px`;
svgElement.style.height = `${clientY - rect.top}px`;
updateDots();
resizeText();
});
function redirectToRoot() {
window.location.href = 'index.html';
}
updateDots();
resizeText();
window.addEventListener('resize', () => {
updateDots();
resizeText();
});
</script>
</body>
</html>