-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
118 lines (101 loc) · 3.12 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Message</title>
<link rel="shortcut icon" href="https://i.imgur.com/mhWNOq3.png" type="image/x-icon">
<style>
@import url('https://fonts.googleapis.com/css2?family=Josefin+Sans&family=Questrial&display=swap');
body {
font-family: 'Josefin Sans', sans-serif;
}
.box {
position: relative;
max-width: 800px;
margin: 0 auto;
text-align: center;
}
.image {
max-width: 100%;
height: auto;
}
.chat {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 10px;
font-size: 250%;
box-sizing: border-box;
}
.wrapper-input {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
display: flex;
align-items: center;
padding: 10px;
background-color: rgba(173, 133, 133, 0.301);
}
.input-bar {
flex-grow: 1;
padding: 10px;
border: 2px solid black;
background-color: transparent;
color: black;
font-family: 'Arial', sans-serif;
}
.enter {
background-color: #007bff;
color: white;
border: none;
padding: 10px 20px;
cursor: pointer;
margin-left: 10px;
}
.enter:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="box">
<img class="image" src="https://i.imgur.com/mhWNOq3.png" alt="BRO, ITS JUST AN IMAGE">
<div class="chat" id="chat"></div>
</div>
<div class="wrapper-input">
<input class="input-bar" type="text" placeholder="Message" id="inputText">
<button class="enter" onclick="addText()">Aggiungi Testo</button>
</div>
<script>
function addText() {
const inputText = document.querySelector('#inputText');
const text = inputText.value;
const chat = document.getElementById('chat');
// Clear the chat box letter by letter
chat.textContent = '';
const interval = 100; // Milliseconds between adding letters
let currentIndex = 0;
function addLetter() {
if (currentIndex < text.length) {
chat.textContent += text[currentIndex];
currentIndex++;
setTimeout(addLetter, interval);
}
}
addLetter();
inputText.value = '';
}
const inputText = document.querySelector('#inputText');
inputText.addEventListener('keydown', function (event) {
if (event.key === 'Enter') {
addText();
}
});
</script>
</body>
</html>