-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2,0.html
More file actions
68 lines (59 loc) · 1.62 KB
/
2,0.html
File metadata and controls
68 lines (59 loc) · 1.62 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>SailorOutfits</title>
<style>
* {
user-select: none;
-webkit-user-select: none; /* For Safari */
-ms-user-select: none; /* For Internet Explorer/Edge */
}
body {
margin: 0;
height: 100vh;
font-family: sans-serif;
color: white;
display: flex;
flex-direction: column;
justify-content: flex-start;
text-align: center;
position: relative;
background: url('IMG_1.jpeg') no-repeat center center fixed;
background-size: cover;
transition: background-image 2.5s ease-in-out; /* Smooth transition between images */
}
h1 {
background: rgba(0, 0, 0, 0.5);
padding: 20px;
border-radius: 10px;
margin-top: 20px;
position: relative;
z-index: 1; /* Ensure the text stays above the background */
}
</style>
</head>
<body>
<h1>Hold the screen or press P if you are on the computer</h1>
<script>
let isImageChanged = false;
function toggleImage() {
if (!isImageChanged) {
document.body.style.backgroundImage = "url('IMG_2.jpeg')";
} else {
document.body.style.backgroundImage = "url('IMG_1.jpeg')";
}
isImageChanged = !isImageChanged;
}
// Keyboard toggle with 'P' key
document.addEventListener('keydown', function(event) {
if (event.key === 'p' || event.key === 'P') {
toggleImage();
}
});
// Touch or click toggle
document.addEventListener('touchstart', toggleImage);
document.addEventListener('click', toggleImage);
</script>
</body>
</html>