-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
41 lines (33 loc) · 1 KB
/
script.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
29
30
31
32
33
34
35
36
37
38
39
40
41
const yesBtn = document.getElementById("yesBtn");
const noBtn = document.getElementById("noBtn");
const body = document.querySelector("body");
yesBtn.addEventListener("click", function () {
sendMessage("Yes");
});
noBtn.addEventListener("mouseenter", function () {
// Change position of the 'No' button on hover
noBtn.style.top = `${
Math.random() * (body.clientHeight - noBtn.clientHeight)
}px`;
noBtn.style.left = `${
Math.random() * (body.clientWidth - noBtn.clientWidth)
}px`;
});
function sendMessage(response) {
if (response === "Yes") {
alert("Boyfriend responded: I LOVE YOU TOO");
}
// No alert for "No" response
}
function createHeart() {
const heart = document.createElement("div");
heart.classList.add("heart");
heart.style.left = Math.random() * 100 + "vw";
heart.style.animationDuration = Math.random() * 2 + 3 + "s";
heart.innerText = "💗";
document.body.appendChild(heart);
setTimeout(() => {
heart.remove();
}, 5000);
}
setInterval(createHeart, 300);