-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.js
More file actions
24 lines (19 loc) · 917 Bytes
/
app.js
File metadata and controls
24 lines (19 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const container = document.querySelector('.container');
const yes_btn = document.querySelector('.yes_btn');
const no_btn = document.querySelector('.no_btn');
no_btn.addEventListener('click', () => {
no_btn.style.position = 'absolute';
const random_left = Math.floor(Math.random() * container.clientWidth);
const random_top = Math.floor(Math.random() * container.clientHeight);
if (random_left >= container.clientWidth / 2)
no_btn.style.left = `${random_left - no_btn.clientWidth}px`;
if (random_top >= container.clientHeight / 2)
no_btn.style.top = `${random_top - no_btn.clientHeight}px`;
})
yes_btn.addEventListener('click', () => {
container.innerHTML = `<h2>
I knew it!!! <br>
Lool 😂😂😂 <br>
Please Subscribe...
</h2>`
})