-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.js
78 lines (64 loc) · 2.35 KB
/
base.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//filters
function filterf(buttons,items){
const filters=document.querySelectorAll(buttons)
const servbox=document.querySelectorAll(items)
filters.forEach(function(button) {
button.addEventListener("click", function() {
for(ff of servbox){
ff.classList.remove('active')
ff.classList.add('not-active')
};
for (let c of filters){
//var idk=c.getAttribute("filter")
if (c!=button){
c.classList.remove('active')
c.classList.add('not-active')
}
else{
c.classList.remove('not-active')
c.classList.add('active')
console.log(c.getAttribute("filter"))
//console.log('filter['+c.getAttribute("filter")+']')
const ddd=document.querySelectorAll(items+"[filter="+c.getAttribute("filter")+"]")
console.log(ddd)
for (let el of ddd){
console.log(el)
el.classList.remove('not-active')
el.classList.add('active')
};
};
};
if (button.getAttribute('filter')=="all"){
button.classList.remove('not-active')
button.classList.add('active')
const ddd=document.querySelectorAll(".service-box")
for (let el of ddd){
console.log(el)
el.classList.remove('not-active')
el.classList.add('active')
};
}
});
});
}
function cursor(){
var cursor = document.getElementById("cursor");
document.body.addEventListener("mousemove", function(e) {
cursor.style.left = e.clientX + "px",
cursor.style.top = e.clientY + "px";
});
}
function to_cred(sel,idd){
const to_cred=document.querySelectorAll(sel)
to_cred.forEach(function(button) {
button.addEventListener("click", function() {
document.getElementById(idd).scrollIntoView();
});
});
}
function langsw(){
console.log("it's empty here")
}
filterf('.filter-bar > button',".service-box");
cursor();
to_cred(".iwant","creds");