-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
148 lines (125 loc) · 3.15 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Owlcarousel
$(document).ready(function () {
console.log("Hello Friend");
const line = document.querySelector(".newDev");
line.innerHTML="Baaz Bikes"
$(".owl-carousel").owlCarousel({
loop: true,
margin: 10,
nav: true,
autoplay: true,
autoplayTimeout: 3000,
autoplayHoverPause: true,
center: true,
navText: [
"<i class='fa fa-angle-left'></i>",
"<i class='fa fa-angle-right'></i>"
],
responsive: {
0: {
items: 1
},
600: {
items: 1
},
1000: {
items: 3
}
}
});
});
// console.log("Hisdf");
const intro = document.querySelector(".intro");
const video = intro.querySelector("video");
const text = intro.querySelector("h1");
//END SECTION
const section = document.querySelector("section");
const end = section.querySelector("h1");
//SCROLLMAGIC
const controller = new ScrollMagic.Controller();
//Scenes
let scene = new ScrollMagic.Scene({
duration: 9000,
triggerElement: intro,
triggerHook: 0
})
// .addIndicators()
.setPin(intro)
.addTo(controller);
//Text Animation
const textAnim = TweenMax.fromTo(text, 3, { opacity: 1 }, { opacity: 0 });
let scene2 = new ScrollMagic.Scene({
duration: 3000,
triggerElement: intro,
triggerHook: 0
})
.setTween(textAnim)
.addTo(controller);
//Video Animation
let accelamount = 0.1;
let scrollpos = 0;
let delay = 0;
scene.on("update", e => {
scrollpos = e.scrollPos / 1000;
var vids = document.getElementById("vid1");
// console.log(vids);
// await vids.play();
});
setInterval(()=>{
delay += (scrollpos - delay) * accelamount;
video.currentTime = delay;
},50)
setInterval(() => {
var page5 = document.getElementById("ContainerPage5");
var finder = document.getElementById("finder");
var pos = page5.getBoundingClientRect();
var topPos = 0;
finder.style.top = "20vh"
if(pos.top <= 0){
finder.style.position = "fixed";
finder.style.left = "16.8vw";
if(pos.bottom < 720){
topPos= pos.bottom - 600;
finder.style.top = topPos;
}
if(pos.bottom <=400){
finder.style.position = "absolute";
finder.style.left = "6.8vw";
}
}
else{
finder.style.position = "absolute";
finder.style.left = "6.8vw";
}
console.log(pos.bottom);
}, 30);
var logo = document.getElementById("logo_p1");
logo.addEventListener('click', ()=>{
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
})
function changeClass(task, tab){
var element = document.getElementById("slider-"+tab);
if(task == "add"){
element.classList.add("slider1");
}
else{
element.classList.remove("slider1");
}
}
function changeTo(event){
var current = event.target.id;
console.log(current);
tabArray = ["tab1", "tab2", "tab3"];
tabArray.forEach(tab=>{
if(tab==current){
changeClass("add",tab);
}
else{
changeClass("remove",tab);
}
})
}
document.querySelectorAll("input[name='tab-control']").forEach((input) => {
input.addEventListener('change', changeTo);
});