-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
91 lines (75 loc) · 2.5 KB
/
script.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
79
80
81
82
83
84
85
86
87
88
89
90
91
// This code work for animated cursor
var crsr = document.querySelector(".cursor");
document.addEventListener("mousemove", function (dets) {
crsr.style.left = dets.x + 30 + "px";
crsr.style.top = dets.y + "px";
});
// This code work for part-2
var tl = gsap.timeline({
scrollTrigger: {
trigger: ".part-2",
start: "50% 50%",
end: "100% 100%",
scrub: true,
}
});
tl.to(".banner-1", {
left: "-25%",
}, 'a')
.to(".banner-2", {
right: "-20%",
}, 'a')
var anim = gsap.timeline();
anim.from(".center-part-1", {
y: -200,
opacity: 0,
duration: 3.5,
scrub: true,
})
// This code work for services section
document.querySelector(".ser-1").addEventListener("mousemove", function () {
document.querySelector(".h-div-1").style.top = "0%";
document.querySelector(".ser-1").style.cursor = "pointer";
})
document.querySelector(".ser-1").addEventListener("mouseleave", function () {
document.querySelector(".h-div-1").style.top = "100%";
})
document.querySelector(".ser-2").addEventListener("mousemove", function () {
document.querySelector(".h-div-2").style.top = "0%";
document.querySelector(".ser-2").style.cursor = "pointer";
})
document.querySelector(".ser-2").addEventListener("mouseleave", function () {
document.querySelector(".h-div-2").style.top = "100%";
})
document.querySelector(".ser-3").addEventListener("mousemove", function () {
document.querySelector(".h-div-3").style.top = "0%";
document.querySelector(".ser-3").style.cursor = "pointer";
})
document.querySelector(".ser-3").addEventListener("mouseleave", function () {
document.querySelector(".h-div-3").style.top = "100%";
})
document.querySelector(".ser-4").addEventListener("mousemove", function () {
document.querySelector(".h-div-4").style.top = "0%";
document.querySelector(".ser-4").style.cursor = "pointer";
})
document.querySelector(".ser-4").addEventListener("mouseleave", function () {
document.querySelector(".h-div-4").style.top = "100%";
})
// This code work for services-section animated cursor
var boxes = document.querySelectorAll(".services-item")
boxes.forEach(function (elem) {
elem.addEventListener("mouseenter", function () {
var att = elem.getAttribute("data-image")
crsr.style.width = "270px"
crsr.style.height = "170px"
crsr.style.borderRadius = "0"
crsr.style.backgroundImage = `url(${att})`
})
elem.addEventListener("mouseleave", function () {
elem.style.backgroundColor = "transparent"
crsr.style.width = "20px"
crsr.style.height = "20px"
crsr.style.borderRadius = "50%"
crsr.style.backgroundImage = `none`
})
})