-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (63 loc) · 2.32 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<title>Type Writer Like ChatGPT</title>
<style>
button {
height: 100px;
width: 250px;
}
.holder {
background-color: #f7f7f8;
height: 100px;
box-shadow: 10px 5px 10px 0px #5e5d5d;
font-size: 1rem;
}
span {
animation: blinker 1s linear infinite;
}
@keyframes blinker {
50% {
opacity: 0;
}
}
</style>
</head>
<body>
<section class="mb-3 product-description-holder row">
<h4 class="w-100 text-center p-5">TypeWriter Effect Like ChatGPT</h4>
<div class="col-12 p-2">
<div contenteditable="true" class="form-control holder" id="txt-holder"></div>
</div>
<div class="col-12 p-5 text-center">
<button class="btn border bg-body-secondary" onclick="typeWriter()">
Start
</button>
</div>
</section>
<script>
const res = [
"I am ChatGPT, a large language model developed by OpenAI. I am designed to converse with humans in a natural and helpful way. I can provide information, answer questions, and engage in conversation on a wide range of topics. How can I assist you today?",
];
let textPosition = 0;
let speed = 20;
const typeWriter = () => {
document.getElementById("txt-holder").innerHTML =
res[0].substring(0, textPosition) +
"<span id='blinker'>\u25ae</span>";
if (textPosition++ < res[0].length) {
setTimeout(typeWriter, speed);
} else {
setTimeout(() => {
document.getElementById("blinker").remove();
}, 3000);
}
};
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>