-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
87 lines (78 loc) · 2.82 KB
/
Copy pathindex.html
File metadata and controls
87 lines (78 loc) · 2.82 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Button with Your Design</title>
<style>
/* Body Style für zentrierten Button */
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh; /* Füllt den gesamten Bildschirm */
margin: 0;
padding: 0;
box-sizing: border-box;
background-color: #f0f0f0;
font-family: Arial, sans-serif;
overflow: hidden; /* Verhindert Scrollen */
}
/* Button-Stil */
button {
background: url('./1x/Artboard 1.png') no-repeat center center; /* Standardbild */
background-size: contain;
border: none;
border-radius: 50%; /* Kreissymbol */
width: 170px;
height: 170px;
max-width: 90vw; /* Responsives Design: Skaliert auf kleinen Geräten */
max-height: 90vh; /* Responsives Design: Skaliert auf kleinen Geräten */
cursor: pointer;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.2);
}
/* Animation beim Klicken */
button:active {
transform: scale(0.95);
box-shadow: none;
}
/* Retina-Unterstützung */
@media (min-device-pixel-ratio: 2), (-webkit-min-device-pixel-ratio: 2) {
button {
background: url('./2x/Artboard 1@2x.png') no-repeat center center;
}
}
@media (min-device-pixel-ratio: 3), (-webkit-min-device-pixel-ratio: 3) {
button {
background: url('./3x/Artboard 1@3x.png') no-repeat center center;
}
}
</style>
</head>
<body>
<!-- Der Button -->
<button id="hiddenCounter"></button>
<script>
let count = 0;
// Lade gespeicherte Klickanzahl aus localStorage
if (localStorage.getItem("hiddenCount")) {
count = parseInt(localStorage.getItem("hiddenCount"));
}
// Button-Klicks zählen
const button = document.getElementById("hiddenCounter");
button.addEventListener("click", () => {
count += 1;
localStorage.setItem("hiddenCount", count);
// Optional: In der Konsole debuggen
console.log(`Button gedrückt. Aktuelle Anzahl: ${count}`);
});
// Zähler täglich um Mitternacht zurücksetzen
const now = new Date();
const millisUntilMidnight = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 1, 0, 0, 0) - now;
setTimeout(() => {
count = 0;
localStorage.setItem("hiddenCount", count);
}, millisUntilMidnight);
</script>
</body>
</html>