-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (24 loc) · 1.03 KB
/
app.js
File metadata and controls
29 lines (24 loc) · 1.03 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
;(function () {
const button_inner = document.querySelector('.button_inner')
const button_outer = document.querySelector('.button_outer')
if (button_inner && button_outer) {
button_inner.addEventListener('mouseenter', function (e) {
const parentOffset = this.offsetParent
const distanceX = e.pageX - parentOffset.offsetLeft
const distanceY = e.pageY - parentOffset.offsetTop
button_outer.style.left = `${distanceX}px`
button_outer.style.top = `${distanceY}px`
button_outer.classList.remove('collapse-circle')
button_outer.classList.add('expand-circle')
})
button_inner.addEventListener('mouseleave', function (e) {
const parentOffset = this.offsetParent
const distanceX = e.pageX - parentOffset.offsetLeft
const distanceY = e.pageY - parentOffset.offsetTop
button_outer.style.left = `${distanceX}px`
button_outer.style.top = `${distanceY}px`
button_outer.classList.remove('expand-circle')
button_outer.classList.add('collapse-circle')
})
}
})()