Skip to content

Commit f886bcd

Browse files
Merge pull request #871 from SonitBahl/SonitBahl-patch-1
Button escape project
2 parents d2be744 + e787ef4 commit f886bcd

File tree

5 files changed

+112
-0
lines changed

5 files changed

+112
-0
lines changed

DateGuarantee/Readme.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# DateGuarantee
2+
3+
Welcome to the DateGuarantee project! This web-based application helps users make confident choices by presenting a simple yes/no question. When users click the "No" button, it moves away, leaving only the "Yes" button to click.
4+
5+
## Features
6+
7+
- Interactive interface with a yes/no choice
8+
- Dynamic movement of the "No" button when clicked
9+
- Customizable background video
10+
11+
## Getting Started
12+
13+
### Prerequisites
14+
15+
Make sure you have a basic web server set up to serve the HTML files.
16+
17+
## Note
18+
Please remember to add a bg.mp4 to have a custom background.

DateGuarantee/congrats.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="styles.css">
7+
<title>Congratulations!</title>
8+
</head>
9+
<body>
10+
11+
<video id="bgVideo" autoplay loop muted>
12+
<source src="bg.mp4" type="video/mp4">
13+
</video>
14+
15+
<h1>YAY <3</h1>
16+
17+
<script src="script.js"></script>
18+
</body>
19+
</html>

DateGuarantee/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<link rel="stylesheet" href="styles.css">
7+
<title>Date</title>
8+
</head>
9+
<body>
10+
11+
<video id="bgVideo" autoplay loop muted>
12+
<source src="bg.mp4" type="video/mp4">
13+
</video>
14+
15+
<h1>Date?</h1>
16+
<div class="button-container">
17+
<button id="yesBtn" onclick="redirectToCongrats()">Yes</button>
18+
<button id="noBtn" onclick="moveNoButton()">No</button>
19+
</div>
20+
21+
<script src="script.js"></script>
22+
</body>
23+
</html>

DateGuarantee/script.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function redirectToCongrats() {
2+
window.location.href = 'congrats.html';
3+
}
4+
5+
function moveNoButton() {
6+
const button = document.getElementById('noBtn');
7+
const maxX = window.innerWidth - button.offsetWidth;
8+
const maxY = window.innerHeight - button.offsetHeight;
9+
10+
const newX = Math.floor(Math.random() * maxX);
11+
const newY = Math.floor(Math.random() * maxY);
12+
13+
button.style.position = 'absolute';
14+
button.style.left = `${newX}px`;
15+
button.style.top = `${newY}px`;
16+
}

DateGuarantee/styles.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
height: 100vh;
5+
overflow: hidden;
6+
display: flex;
7+
align-items: center;
8+
justify-content: center;
9+
flex-direction: column;
10+
}
11+
12+
#bgVideo {
13+
position: fixed;
14+
width: 100%;
15+
height: 100%;
16+
object-fit: cover;
17+
z-index: -1;
18+
}
19+
20+
.button-container {
21+
text-align: center;
22+
z-index: 1;
23+
}
24+
25+
button {
26+
padding: 10px 20px;
27+
font-size: 16px;
28+
cursor: pointer;
29+
display: block;
30+
margin: 10px auto;
31+
}
32+
33+
h1 {
34+
text-align: center;
35+
color: white;
36+
}

0 commit comments

Comments
 (0)