-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
64 lines (54 loc) · 1.68 KB
/
app.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function mouseFollower(){
let body = document.querySelector("body");
let mouseFollower = document.querySelector("#mouse-follower");
let mouseFollowerDefText = mouseFollower.innerText;
let allAnchor = document.querySelectorAll("a");
let allBtns = document.querySelectorAll("button");
body.addEventListener("mousemove", function(e){
mouseFollower.style.left = `${e.clientX}px`
mouseFollower.style.top = `${e.clientY}px`
})
allAnchor.forEach(function(a){
a.addEventListener("mouseover", function(){
mouseFollower.innerText = "Click";
})
})
allAnchor.forEach(function(a){
a.addEventListener("mouseleave", function(){
mouseFollower.innerText = mouseFollowerDefText;
})
})
allBtns.forEach(function(btn){
btn.addEventListener("mouseover", function(){
mouseFollower.innerHTML = "Click";
})
})
allBtns.forEach(function(btn){
btn.addEventListener("mouseleave", function(){
mouseFollower.innerHTML = mouseFollowerDefText;
})
})
}
function menuBar(){
let sideBar = document.querySelector("#sidebar-container");
sideBar.style.transition = "1s";
let menuBtn = document.querySelector("#menu-btn");
let isMenu = false;
menuBtn.classList.add("ri-menu-3-line");
menuBtn.addEventListener("click", function(){
isMenu = !isMenu;
if(isMenu){
sideBar.style.right = "0%";
sideBar.style.top = "0%";
menuBtn.classList.remove("ri-menu-3-line");
menuBtn.classList.add("ri-close-fill");
} else{
// sideBar.style.right = "-100%";
sideBar.style.top = "-100%";
menuBtn.classList.remove("ri-close-fill");
menuBtn.classList.add("ri-menu-3-line");
}
})
}
// mouseFollower();
menuBar();