-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfit.html
124 lines (112 loc) · 3.98 KB
/
fit.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Cat Generator</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background: linear-gradient(to right, #ff7e5f, #feb47b);
font-family: Arial, sans-serif;
}
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
padding: 10px 20px;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
.title {
font-size: 24px;
color: #fff;
}
.menu-button {
background: none;
border: none;
color: #fff;
font-size: 20px;
cursor: pointer;
}
.container {
position: relative;
width: 80%;
height: 60vh;
display: flex;
justify-content: center;
align-items: center;
background: rgba(255, 255, 255, 0.2);
border-radius: 20px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
overflow: hidden;
border: 10px solid rgba(255, 255, 255, 0.2); /* Border margin */
}
#catImage {
width: 100%;
height: 100%;
object-fit: contain;
border-radius: 20px;
opacity: 0.8; /* Make the image slightly transparent */
}
.button {
margin-top: 20px;
padding: 10px 20px;
background: rgba(255, 255, 255, 0.5);
color: #333;
border: none;
border-radius: 5px;
cursor: pointer;
backdrop-filter: blur(5px);
transition: background 0.3s;
}
.button:hover {
background: rgba(255, 255, 255, 0.8);
}
</style>
</head>
<body>
<div class="container">
<img id="catImage" src="" alt="Random Cat Image" />
</div>
<button class="button" onclick="location.reload()">
I Want More Cats ❤️
</button>
<script>
const catImage = document.getElementById("catImage");
// Function to fetch a random cat image from Cataas API
const fetchCatImage = async () => {
try {
// Display loading animation
catImage.src =
"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
const response = await fetch("https://cataas.com/cat");
if (!response.ok) {
throw new Error("Failed to fetch cat image");
}
const data = await response.blob();
const imageUrl = URL.createObjectURL(data);
catImage.src = imageUrl;
} catch (error) {
console.error(error);
}
};
// Call the fetchCatImage function to load a cat image when the page loads
fetchCatImage();
function toggleMenu() {
const navLinks = document.querySelector(".nav-links");
navLinks.classList.toggle("menu-open");
}
</script>
</body>
</html>