-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogo.js
More file actions
31 lines (26 loc) · 894 Bytes
/
Copy pathlogo.js
File metadata and controls
31 lines (26 loc) · 894 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
25
26
27
28
29
30
31
import { HideFab, ShowFab } from './fab';
import { cancelCursorAnim, setCursorData } from './utils';
export function InitLogo(lenis, isHovering) {
const logo = document.querySelector('#logo');
const cursorTitle = document.querySelector('.hover-cursor-content');
const cursorBackground = document.querySelector('.hover-cursor-background');
logo.addEventListener('click', () => {
lenis.scrollTo(0);
isHovering = false;
cancelCursorAnim();
HideFab(cursorBackground, cursorTitle);
});
logo.addEventListener('mouseenter', () => {
if (!window.scrollY) return;
setCursorData(logo);
isHovering = true;
setTimeout(() => {
if (isHovering) ShowFab(cursorBackground, cursorTitle);
}, 100);
});
logo.addEventListener('mouseleave', () => {
isHovering = false;
cancelCursorAnim();
HideFab(cursorBackground, cursorTitle);
});
}