html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Doll Figure</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!-- 👆🏻 -->
<div class="tap-label"><b>Double-tap the screen to open</b></div>
<!-- Phone body -->
<div class="phone">
<div class="front-cam"></div>
<div class="side"></div>
<!-- Screen -->
<div class="screen" id="phoneScreen">
<!-- Time Display -->
<div class="time-display" id="timeDisplay"></div>
<!-- Music Player -->
<div class="music-player">
Enter to Rename, Shift+Enter to Preview
css
css
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
/* General Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f8f8f8;
transition: background-color 1s ease-in-out;
}
/* Label as Tap Anywhere Instruction */
.tap-label {
position: absolute;
top: 5%;
font-size: 16px;
color: #92ada4;
background: #white;
border: 5px solid #d1e0de;
padding: 8px 12px;
border-radius: 10px;
box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
transition: opacity 0.3s ease-in-out;
Enter to Rename, Shift+Enter to Preview
js
js
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
document.addEventListener("DOMContentLoaded", function () {
let lastTap = 0;
const screen = document.getElementById("phoneScreen");
const lockScreen = document.getElementById("lockScreen");
if (!screen || !lockScreen) {
console.error("Error: Elements not found!");
return;
}
// Double-tap to turn on/off screen
screen.addEventListener("touchend", function (event) {
const currentTime = new Date().getTime();
const tapLength = currentTime - lastTap;
if (tapLength < 300 && tapLength > 0) {
screen.classList.toggle("on");
lockScreen.classList.add("hidden"); // Hide lock screen when turning off
}
lastTap = currentTime;
});
// Swipe up or down to show lock screen
let startY = 0;
screen.addEventListener("touchstart", function (event) {
startY = event.touches[0].clientY;
});
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Uruchom