-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
33 lines (26 loc) · 1.16 KB
/
script.js
File metadata and controls
33 lines (26 loc) · 1.16 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
function nextPages() {
window.location.href = "yes.html";
}
function moveButton() {
const noButton = document.getElementById("noButton");
const yesButton = document.getElementById("yesButton");
// Tambahkan efek getar
noButton.classList.add("wiggle");
setTimeout(() => {
noButton.classList.remove("wiggle");
}, 500);
// Dapatkan ukuran layar dan batas pergerakan tombol
const maxX = window.innerWidth - noButton.offsetWidth;
const maxY = window.innerHeight - noButton.offsetHeight;
// Pastikan tombol tetap berada dalam layar
const randomX = Math.max(0, Math.random() * maxX);
const randomY = Math.max(0, Math.random() * maxY);
noButton.style.position = "absolute";
noButton.style.left = `${randomX}px`;
noButton.style.top = `${randomY}px`;
// Membesarkan tombol "Yes"
const currentSize = parseFloat(window.getComputedStyle(yesButton).fontSize);
yesButton.style.fontSize = `${currentSize * 1.2}px`; // Membesar 20% setiap klik
}
// Pastikan tombol juga bisa bergerak di perangkat sentuh
document.getElementById("noButton").addEventListener("click", moveButton);