-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFUXK.html
More file actions
43 lines (41 loc) · 1.2 KB
/
FUXK.html
File metadata and controls
43 lines (41 loc) · 1.2 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
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
let btn1 = document.querySelector('.btn1')
let btn2 = document.querySelector('.btn2')
let x,y = 0
let stick = false
let body = document.querySelector('body')
let magnet = document.querySelector('.magnet')
document.addEventListener('mousemove', function(e){
let left = e.offsetX
let top = e.offsetY
magnet.style.left = left + 'px'
magnet.style.left = left + 'px'
x = e.offsetX
y = e.offsetY
if (top - btn1.style.top < 200){
stick = true
}
})
let i = 0
document.addEventListener('click', function(){
i++
if (i % 2 == 1){
btn1.classList.add('animate')
} else {
btn1.classList.remove('animate')
}
})
</script>
</head>
<body>
<button class="btn1">JS-99</button>
<button class="btn2">일반금속</button>
<div class="magnet">Magnet</div>
</body>
</html>