-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (31 loc) · 1.46 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
function changeSad(){
document.getElementById("img").src="src/C1.gif";
}
document.getElementById("No").addEventListener("mouseover",function(){
changeSad();
let noButton=document.getElementById("No");
let mainDiv=document.getElementById("main");
let bodyWidth=window.innerWidth-noButton.clientWidth;
let bodyHeight=window.innerHeight-noButton.clientHeight;
let mainDivPos=mainDiv.getBoundingClientRect();
let randomX,randomY;
do{
randomX=Math.floor(Math.random()*bodyWidth);
randomY=Math.floor(Math.random()*bodyHeight);
}while((randomX+noButton.clientWidth>mainDivPos.left && randomX<mainDivPos.right
&& randomY+noButton.clientHeight>mainDivPos.top && randomY<mainDivPos.bottom));
noButton.style.position="absolute";
noButton.style.left=randomX+"px";
noButton.style.top=randomY+"px";
content=["Really?","Why not?","Heyy!!","Come on!","Seriously?","Chill!!","Think!!","Give a try!","Ha ha ha!!","I disagre!!","Not happening🗿","Bruhh!","pls!"]
noButton.innerHTML = "No<br><span style='font-size: 14px; color: gray;'>("
+ content[Math.floor(Math.random() * content.length)] + ")</span>";
});
function makeHappy(){
document.getElementById("No").remove();
document.getElementById("img").src="src/HAPPY.gif";
document.getElementById("yes").innerHTML="<span style='font-style:italics'>Call me:9445462959✨</span>";
}
function makeSad(){
document.getElementById("img").src="src/SADD.gif"
}