Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ const yesBtn = document.querySelector(".yes-btn");
const noBtn = document.querySelector(".no-btn");

yesBtn.addEventListener("click", () => {
gif.style.width = gif.getBoundingClientRect().width + "px";
gif.style.height = gif.getBoundingClientRect().height + "px";
question.innerHTML = "Yay, see you on the 18th!";
gif.src =
"https://media.giphy.com/media/UMon0fuimoAN9ueUNP/giphy.gif";
gif.src ="https://media.giphy.com/media/UMon0fuimoAN9ueUNP/giphy.gif";
noBtn.style.opacity = "0";
yesBtn.style.marginLeft = "0px";
});

noBtn.addEventListener("mouseover", () => {
function handleNoBtn () {
noBtn.style.left = noBtn.getBoundingClientRect().x + "px";
noBtn.style.top = noBtn.getBoundingClientRect().y + "px";
const noBtnRect = noBtn.getBoundingClientRect();
const maxX = window.innerWidth - noBtnRect.width;
const maxY = window.innerHeight - noBtnRect.height;
Expand All @@ -20,4 +25,7 @@ noBtn.addEventListener("mouseover", () => {

noBtn.style.left = randomX + "px";
noBtn.style.top = randomY + "px";
});
}

noBtn.addEventListener("mouseover", handleNoBtn);
noBtn.addEventListener("click", handleNoBtn);
2 changes: 2 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ button {
button:nth-child(1) {
margin-left: -200px;
background: #e94d58;
transition: all 2s ease;
}
button:nth-child(2) {
margin-right: -200px;
background: white;
color: #e94d58;
transition: top 200ms linear, left 200ms linear, opacity 500ms linear;
}